【发布时间】:2014-09-27 17:48:58
【问题描述】:
代码有什么问题?谢谢。
using UnityEngine;
using System.Collections;
public class qwe : MonoBehaviour {
public GameObject cube;
public float speed=500;
GameObject zxc;
// Update is called once per frame
void Update () {
if(Input.GetButtonUp("Jump")){
GameObject CUBE = (GameObject)Instantiate(cube, transform.position, transform.rotation);
CUBE.rigidbody.AddForce(new Vector3(-speed,0,0));
}
}
void OnCollisionEnter (Collision theCollision)
{
if(theCollision.gameObject.name == “cube”)
{
Destroy(theCollision.gameObject);
Debug.Log(“We have hit the wall”);
}
}
}
【问题讨论】:
-
代码是否真的包含那些不正确
“cutesy”-quotes?如果是这样,请修复它们,使它们看起来像"this"。另外,第 22 行是哪一行? -
如果你从头数数,那就是第 22 行。