Unity Community |

Hello,
i'm making a 3D platform game, and if you Hit an enemy, the enemy plays an animation, it works perfect,
but if i put some more prefabs of the enemy in the game(yes i updated the prefab), when i hit ONE enemy, all the rest plays the same animation. (it is a rigged character)
so i want, if you hit enemy 1, enemy 1 does the animation, and if you hit enemy 2 then enemy 2 does the animation. And not all at the same time
how can i solve this problem
Greets Dylan
here you can see the two enemies, if i hit the, the must do a "dead" animation
Pleas help me, i am really stuck in this part of the pipeline
Hello!Could you post the code?
You might be referencing the same GameObject.
-Ted
Code:
#pragma strict static var IsANIMATING = false; public var IsPushingEnter = false; static var IPE = 0; private var m_StartCounter = 0; private var m_Counter = 0.0; public var m_TimeLengtOfEnter = 0.8;//0.6 var Explosie: Transform; private var m_IsGaanVliegen = 0; static var m_Gevlogen = 0; } if(IsPushingEnter == true)IPE =1; // IPE = Is Pressing Enter for 1 second long; (i use IPE in other scripts) else IPE=0; { m_StartCounter = 1; // Here i am making a counter so that if i press the attack button keeps active for 1 second } if(m_StartCounter == 1) { } if(m_Counter > 0.1 && m_Counter < m_TimeLengtOfEnter) { IsPushingEnter = true; } if(m_Counter > m_TimeLengtOfEnter) { m_StartCounter = 0; IsPushingEnter = false; m_Counter = 0; } if(m_IsGaanVliegen == 1)m_Gevlogen = 1; if(m_Gevlogen == 1)GaVliegenAnim(); // If i hit the ATTACK btn then do the function GaVliegenAnim() means Go FlyAnimation } { if(IsPushingEnter==true) { var Exp = Instantiate(Explosie,gameObject.transform.position,Quaternion.identity); //here i make some particles m_Gevlogen= 1; } } function GaVliegenAnim() // AND 1HERE IS THE IMPORTANT CODE, it works on 1 object { IsANIMATING = true; // this i use in a other script so not important IsANIMATING = false; m_IsGaanVliegen = 0; // not important m_Gevlogen = 0; // not important }
This script is attached to Collision_Down, it has a mesh collider with trigger ON
and this is what it looks like
click this to see the image bigger : http://i45.tinypic.com/27yu2r5.jpg
Last edited by dylan2008; 04-29-2012 at 01:41 AM.
Last edited by BluntWeapon; 04-29-2012 at 07:04 AM.
thanks you verry much , i am gonna try to solve it now
Thank you So much, the problem is fixed, YES !!!