Headers in property window

Is there any way we can create headers in property window like we do in Unity Editor?UnityHeader|347x457

1 Like

@jare Can you help with this?

perhaps, it will help youPropertyHeaders.zip (599.8 KB)

Thanks for the reply. However I attached the script in a different project and I am getting the following warning: Failed to load inspector packages://property-enum/inspector/test/test.js for component “PropertyHeaders” . Also no properties are visible for the script.

Reference:https://docs.cocos2d-x.org/creator/manual/en/extension/extends-inspector.html
you do not copy the package folder to the different project?

What all should I copy to the other project?

PropertyHeaders.js and package folder


image

This works perfectly. Just one more thing: How do I do this in typescript? Where I do write the editor: CC_EDITOR && {
inspector: “packages://property-enum/inspector/test/test.js”,
} part in Typescript?

reference:

const {ccclass, property, inspector} = cc._decorator;

@ccclass
@inspector("packages://property-enum/inspector/test/test.js")
export default class NewClass extends cc.Component {

    @property
    foo: string = "foo";

    @property
    bar: string = "bar";

    @property
    x: number = 200;

    @property
    y: number = 300;
}

you can find series api in creator.d.ts
eg:

I want to write custom headers instead of strings and numbers, is there any way? @jare @Big_Bear

I do not fully understand what you want to implement, pls tell me more, or you can give me a design sketch

UnityHeader

For example, current provision as mentioned above only separates strings and nums.

I want to write custom headers like the one’s attached in the image. ( ‘TRUTH’ , ‘ALARMS’ )

you can edit the ‘test.html’ at package folder to implement the requirement.

using UnityEngine;

public class Example : MonoBehaviour
{
    [Header("Health Settings")]
    public int health = 0;
    public int maxHealth = 100;

    [Header("Shield Settings")]
    public int shield = 0;
    public int maxShield = 0;
}

Thanks for your reply. But I need to add headers dynamically for each script like this option in Unity. Cannot add every time to the test.html file if I need a new custom header.

not support yet.

Is there any way we can add this to feature request?

we are updating the editor to a new version. before it finished, no way to implement it

Okay thanks. When can we expect the new version?