- Home /
Wrong Animation Is Played
So i have A ui i button that, when it is pressed does the "shoot function" in a script which is connected to an empty game object which i call manager, the script is this:
#pragma strict
import UnityEngine.UI;
var Effect1 : Transform;
var Effect : Transform;
var TheDammage = 100;
var layerMask = 1 << 8;
var reload : int = 0;
var button : Transform;
var obj : GameObject;
function shoot () {
var hit : RaycastHit;
audio.Play();
reload += 1;
var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));
if (Physics.Raycast (ray, hit, 100))
{
var particleClone = Instantiate(Effect, hit.point, Quaternion.LookRotation(hit.normal));
Destroy(particleClone.gameObject, 0.5);
hit.transform.SendMessage("ApplyDammage", TheDammage, SendMessageOptions.DontRequireReceiver);
}
if(reload == 7){
button.GetComponent(Button).interactable = false;
reload -= 100;
obj.GetComponent(waldo).waldoisreal();
Invoke("reloadisback", 3);
}
}
function reloadisback (){
button.GetComponent(Button).interactable = true;
reload += 93;
}
from this it gets the obj;game object which is my gun and accesses its script which is waldo and then the function waldo is real.
(Sorry for weird script and function names)
that script is this:
#pragma strict
function waldoisreal () {
animation.Play("welod");
}
however here in lies the problem
it doesn't not play the animation "welod" it plays a different animation out of the three that are attached to the gun game object. they are: noaim letaim and welod(welod isthe one i want to play)
all of these animation are of legacy type 1 and our "clamp forevers'
the animation it does play instead of "welod" however is "noaim",
if can help it would be highly appreciated and thanks in advance
Your answer
Follow this Question
Related Questions
error keeps looping (smartfox connection) even after I stop testing my game 1 Answer
Where is the problem? 0 Answers
Animation goes wrong when adding new Keyframe. 0 Answers
OnTriggerEnter firing late? 1 Answer
GetPixel Returning Inaccurate Color 1 Answer