CodePudding user response:
This. Hang NewScript sheep2 this node has. Js this script?If you have try this. Sheep2. GetComponent (" NewScript). Setj (2);
CodePudding user response:
GetComponent (' NewScript) don't add. Js suffixCodePudding user response:
Look at my blog at https://blog.csdn.net/S_clifftop/article/details/94456992CodePudding user response:
NewScripts. The use of the module in the js. Exports or ccclass writing, and then in the need to use the module or class (documents) in var=the require XXX ('/NewScripts');For example, in NewScripts. Js code:
The module. Exports={
Name: 'qq_45330885'
}
So in the use of places:
Var SomeOne=the require ("../NewScripts');
Cc. The log (SomeOne. Name);
//the hope can help you