I’ve just started developing for cocos creator 2.0 using typescript and I’ve got a pair of classes that each reference each other in the editor However in editor I get the error “The ‘type’ attribute of ‘Weapon.playerController’ is undefined when loading script”. Additionally, the “PlayerController” property is always null and cannot have anything dragged into it. The classes are in separate files.
From what I can find it appears to be a circular reference and I did find a couple people with similar issues but they were using Javascript and it didn’t help me. Below is the relevant snippets, any suggestions?
I have the same question, I worked around creating a reference to one node with this script and accessing to his property with .getComponent(String) method of Node.
it’s a really bad approach because because if one developer or artist modify the name of the script or the node… All will fail.
I really think one admin must explain this, because it’s a big deal if you are trying to implement any pattern or you are simply trying to access to an property of another script. @slackmoehrle, @jare