Home > other >  Unity5 how to call an object was not on the scene in the script
Unity5 how to call an object was not on the scene in the script

Time:09-16

Such as I've added A objects A, B, add A script on the object, then drag the folder, delete the scene, adding in the object B B script, want to invoke A script in the script B the method how to invoke,
Ps: I will be a of the script:
Public static a A_a;
In the Start method A_a=this;
The script B directly or move A.A _a. The method name don't call
Ps:
The script B with GameObject. Find (" A ".) GetComponent It's no use (), like because can't find the object
Then how to call

CodePudding user response:

First create AClone, again according to AClone get a script, and then call

CodePudding user response:

How code is used to implement, how to invoke a script in the script b?

CodePudding user response:

Your not in the scene, a start is not executed, you drag a objects to the scene in the call,

CodePudding user response:

The problem is A goods can't appear in the scene

CodePudding user response:

If clear A would never be instantiated to scenario, you can directly declare an open A variable B script, then supervisors panel put you under the folder of the precast body assigned to this variable B, it is important to note that this is A direct access to the instance, prefabricated body, please do not modify anything A object,

CodePudding user response:

Must first be loaded into the scene to call,
  • Related