GC1983
1
I have an array of GameObjects that I am adding to a list. Say if I had an OnTriggerEnter execute from another script and it calls for an animation from that particular object it hit out of the list…How do I access the animation of the GameObject that Im colliding with?
void Start()
{
brickBlock = new GameObject[count];
brickBlocks = new List<GameObject>(count);
if(isBrick)
{
foreach(GameObject brickType in brickBlock = GameObject.FindGameObjectsWithTag("BrickBlock"))
{
brickBlocks.Add(brickType);
//count++;
}
}
}
public static void BreakBrick()
{
//Play animation of collided object
}
Xtro
2
in OnTriggerEnter event:
other.gameObject.animation.Play();
If you use OnTriggerEnter(Collider other) the argument it has contains all the informations about the object. So it would be something like Other.animation.etc.etc