- Home /
Text Animation not playing
I have pong game in which the ball is passing through a bonus gate. I created 3D text animation that I want to be triggered when the ball hits the gate collision. I already have a particle effect that works. I assume I can trigger the 3D text the same way (using function OnTriggerEnter (collision : Collider).
The animation plays fine in animation window but will not play in game. I assume it is the code. Here is the code: var particleSquares : GameObject; var bonus50Number : AnimationClip; //var bonus50 : GameObject;
function OnTriggerEnter (collision : Collider) { if(collision.transform.name == "Ball") { Instantiate(particleSquares, transform.position, transform.rotation);
mainGameScript.AddScoreForBonusArea();
audio.Play();
GameObject.Find("bonus50Numer").animation.Play("bonus50");
//animation.Play("bonus50");
//Instantiate(bonus50Number, transform.position, transform.rotation);
} }
This code is not triggering the animation clip but it nicely triggers the paritcle effect. Any ideas on how to fix it. Do I need to use the GUI text for this sort of animation?
Thanx for any help.
Cheers
Please format your code. If you don't know how, watch the tutorial video :)
Your answer
![](https://koobas.hobune.stream/wayback/20220613112242im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
HELP with scripting where GUI is involved 2 Answers
how do i use two animations on the same object?? 1 Answer
Text displays during animation 1 Answer
GUIText Help 1 Answer
Text Outline is not working 1 Answer