Attributes categories

Its will be awesome to have opportunity to categorise attributes. In Unreal/Unity we have 2 different implementations:

So in playcanvas attributes categorisation feature missing, will be awesome to have any, its can be implemented like this:

  • unreal-like - add new arg category to attributes.add()
TestScript.attributes.add("va1", 
  { type: "string", category: "Character | Movement" }
);
  • unity-like - add new function attributes.header()/attributes.space() imho easier to implement and display in editor
const TestScript = pc.createScript("testScript");

TestScript.attributes.header("Some category name", { type: "string" });
TestScript.attributes.add("va1", { type: "string" });
TestScript.attributes.space(20);

TestScript.attributes.header("Some category name 2", { type: "string" });
1 Like

It’d be definitely great to have, we’ve had multiple requests in this area already, see some here:

Please create new issue there as well if possible. Thanks!

2 Likes

You can use the ‘json’ type to make toggleable categories (example below), but I think it only goes one level deep. Totally agree on what you’re suggesting, would love a divider and spacer, etc.

// Attribute Section
ScriptName.attributes.add('section_1', {
    type: 'json',
    title: 'Section 1',
    schema: [{
        name: 'first_name',
        type: 'string',
        title: 'First Name'
    }, {
        name: 'last_name',
        type: 'string',
        title: 'Last Name'
    }]
});

ScriptName.attributes.add('section_2', {
    type: 'json',
    title: 'Section 2',
    schema: [{
        name: 'first_name',
        type: 'string',
        title: 'First Name'
    }, {
        name: 'last_name',
        type: 'string',
        title: 'Last Name'
    }]
});
2 Likes