|
UnassignedReferenceException: The variable coconut_bl of 'controlfs' has not been assigned.
You probably need to assign the coconut_bl variable of the controlfs script in the inspector.
UnityEngine.Object.Internal_InstantiateSingle (UnityEngine.Object data, Vector3 pos, Quaternion rot) (at C:/BuildAgent/work/cac08d8a5e25d4cb/Runtime/ExportGenerated/Editor/UnityEngineObject.cs:72)
UnityEngine.Object.Instantiate (UnityEngine.Object original, Vector3 position, Quaternion rotation) (at C:/BuildAgent/work/cac08d8a5e25d4cb/Runtime/ExportGenerated/Editor/UnityEngineObject.cs:82)
kzfsscript.Update () (at Assets/scrits/controlfs.js:8)
这个是报错提示,表米安看起来是我的controlfs脚本的变量coconut_bl 没有被赋值,但是我赋值了!
以下是代码:
var throwsound:AudioClip;
var coconut_bl:Rigidbody;
function Update(){
if(Input.GetButtonDown("Fire1")){
audio.PlayOneShot(throwsound);
var newcoconut:Rigidbody;
newcoconut = Instantiate(coconut_bl,transform.position,transform.rotation);
newcoconut.velocity = transform.forward*30.0;
}//定义鼠标,click之后出现一个发射的物体--椰子。
}
|
|