代码中的问题是什么?谢谢。
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”);
}
}
}
答案 0 :(得分:1)
使用这些“”引号:
Debug.Log("We have hit the wall");
而不是“”引号:
Debug.Log(“We have hit the wall”);