Custom component class names warning

Custom component class names warning
0.0 0

#1

Hello there :slight_smile:

I’ve specified custom name for my Target component class

@ccclass(“Gameplay/Target”)
export default class Target extends cc.Component {

}

This way my component classes are organized in sub-menus under ‘Add Custom Component’ drop-down. Otherwise it would be unmanagebly huge flat list with hundreds of elements.

But Cocos Creator (at least 1.9.2, don’t think that version is relevant though) shows warnings like this:

Should not specify class name Gameplay/Target for Component which defines in project.

Why? What is the downside of this approach and what is an alternative to organize components menu?

Thanks for the answer.


#2

Use @menu(“Gameplay/Target”)


#3

Awesome! Thanks. Will dig into that cc._decorator for other useful stuff :slight_smile: