unity3d敌人预制动画师未初始化:S

时间:2014-10-29 14:25:31

标签: android unity3d unityscript

你好,我需要帮助动画师不要在我的敌人预制件上初始化 我应该怎么做我已经尝试将所有东西拖到检查员,但它不能正常工作这是我的最后一个问题,我的游戏已经完成请帮帮我

ps我的敌人预制件有一个机械动画并且我实例化它们(我正在使用精灵)并且它说从预制件中初始化但是在预制件中它不会初始化并且它不会让我的敌人改变动画

这里的语法是:

 Animator has not been initialized.
 UnityEngine.Animator:SetFloat(String, Single)
 enemyscript:playerhit() (at Assets/enemies/enemyscript.js:17)
 main:OnCollisionEnter2D(Collision2D) (at Assets/scripts/main.js:138) ///this just calls the function below



#pragma strict
var enemysmall : GameObject;
var speed : float = 1.0;
var enemysmallanim : Animator;

function Start () {

    this.transform.position.x = 8.325;
   this.transform.position.y = -1.2;
enemysmallanim = GetComponent(Animator);
enemysmallanim.SetFloat("isDead",0.0);


}

function playerhit(){
enemysmallanim.SetFloat("isDead",1.0);   //<line 17
}

function Update(){
this.transform.Translate(Vector3(Input.GetAxis("Horizontal") * speed * Time.deltaTime, 0, 0));
this.rigidbody2D.velocity = Vector2(-5,0);
}

0 个答案:

没有答案