Reputation: 49
i made a script and attached it to 3d text, now my problem is accessing the method from that script to other class
Upvotes: 1
Views: 156
Reputation: 125305
You are using FindGameObjectsWithTag
with 's' in the Object
. Use FindGameObjectWithTag
without 's' in the Object
. The version of this function with 's' is for array but g is not defined as array.
That line of code should be:
g = GameObject.FindGameObjectWithTag("tagText No");
Upvotes: 4
Reputation: 1367
FindGameObjectsWithTag returns an array of gameobjects (GameObject[]
), and you are trying to assign it into a GameObject
.
Use FindWithTag
instead :
g = GameObject.FindWithTag("tagText no");
Upvotes: 2