- Home /
Question by
Dave 11 · May 23, 2011 at 06:57 PM ·
gameobjectarraysyntax-errorbce0019
Getting an error while script reference says it's ok
Look, I got the following error. My script:
if(gameObject.FindGameObjectsWithTag("selected") != null) {
gameObject.FindGameObjectsWithTag("selected").tag = "component";
}
The error:
BCE0019: 'tag' is not a member of 'UnityEngine.GameObject[]'.
The script reference says:
GameObject.tag
var tag : string
Description
The tag of this game object.
A tag can be used to identify a game object. Tags must be declared in the tag manager before using them.
gameObject.tag = "Player";
So, what's wrong with the code above? :)
Comment
Best Answer
Answer by flaviusxvii · May 23, 2011 at 07:00 PM
Hint 1: FindGameObject*s*WithTag <-- Notice the S in OBJECTS
Hint 2: UnityEngine.GameObject[] <-- those Brackets mean ARRAY. ARRAYs don't have tags.