Hi! I’ve been working on Cocos Creator for a few months now and this was the first time I happened to encountered this problem. There were times I can’t drag my node to my cc.Label at custom component because it is said to be null.
I also got an error message where the string from getComponent(cc.Label) was unidentified.
(This is a button node with cc.Label component)
this.node.getChildByName('text').getComponent(cc.Label).string = '-';
“Uncaught TypeError: Cannot set property ‘string’ of null”
I also got a warning from the Cocos Creator console…
‘Can not instantiate CCClass ‘undefined’ with argument’
…which is probably meant for cc.Label.