- Home /
Parameter does not exist
I do not know what is the problem.
using UnityEngine;
using System.Collections;
public class FireController : MonoBehaviour {
public GameObject bulletPrototype;
Animator anim;
bool onFire = false;
// Use this for initialization
void Start () {
anim = GetComponent<Animator> ();
}
// Update is called once per frame
void FixedUpdate () {
if(onFire){
anim.SetTrigger("Bullet");
onFire = false;
}
}
public void animat(){
onFire = true;
}
public void Shoot(){
GameObject bulletCopy = Instantiate (bulletPrototype);
bulletCopy.transform.position = new Vector3(transform.parent.position.x+1.35f,transform.parent.position.y+0.15f,0f);
bulletCopy.GetComponent<BulletController> ().direction = new Vector3 (transform.parent.localScale.x,0,0);
}
}
Have you attached the script to the object which has the animator component attached? Also, have you set the animator controller which has the parameter to the animator component of the object?
Answer by MrMarkusHD · Aug 23, 2017 at 02:16 PM
@csco There is a really easy way to fix that...
Go to Window > Animator ||||| Than in the up left corner you should see Layers, Parameters ||||| Click on Parameters ||||| Than on the little "+" sign ||||| And pick Trigger ||||| Than make as many as you need and rename them on what you need ||||| ||||| example.... rename the trigger to Bullet |||||
Answer by csco · Dec 06, 2015 at 02:43 PM
I think the problem is that I had placed an animator in object that is a child of another object which already has an animator, so only the parameters used for the father's animator are useful; I solved this problem by creating an animation from the father object. That is the only solution that I have found.
Answer by dhurstdev · Feb 17, 2017 at 09:12 AM
If the error is from AssetDatabase.Refresh(): "Parameter 'Normal' does not exist. UnityEditor.AssetDatabase:Refresh()", you can put the Refresh call in a Couroutine with "yield return null;" before it, to fix the warning.