Sorry if this has been asked before, I searched for a while and I could not find a solution. Is it possible to add a custom component as a property in a CCClass (a component to be exact)? Something like doing this:
properties: { player: cc.Sprite },
but I would like, instead of having a cc.Sprite as the type, to have a custom component, eg. ‘PlayerController.js’:
properties: { playerController: 'PlayerController' },
This obviously just creates a string property. A very simple obvious workaround is having the property as a cc.Node
and having this node in start()
:
this.playerController = this.playerControllerNode.getComponent('PlayerController');
Is it possible to have the custom component (eg. ‘PlayerController’) directly as a property?