Hi, I need help to get an animation from an other script to play on colision
the obstacle script
if(object == colision.name){
colision.GetComponent("character").GetComponentInChildren["1"].animation.CrossFade("win", 0.3);
Hi, I need help to get an animation from an other script to play on colision
the obstacle script
if(object == colision.name){
colision.GetComponent("character").GetComponentInChildren["1"].animation.CrossFade("win", 0.3);
Ok , you cant test fore collisions on a 3rd party object but you can ask the colliding object to send a function to your desired object. Lets say you want Object A to animate when Object B collides with Object C. you can use BroadcastMessage like this
//this script is on object B
var ObjectA : GameObject;
function OnCollisionEnter(collision : Collision){
if(collision.CompareTag("ObjectB"))
{
ObjectA.BoradcastMessage("Animate");
}
}
this will send a message to ObjectA to run the function “Animate”.