public class NewBehaviourScript : MonoBehaviour
{
private string hitobject;
void Update () {
if (Input.GetButtonUp ("Jump")) {
Debug.Log("SPACE");
Rigidbody r = GameObject.Find("trigger").AddComponent<Rigidbody>();
r.mass = 3f;
}
}
void OnCollisionEnter(Collision myCollision)
{
hitobject = myCollision.gameObject.tag;
if (hitobject == "wall")
{
Destroy(hitobject);
}
}
}
Whats the problem?
Error says:
Assets/NewBehaviourScript.cs(20,25): error CS1502: The best overloaded method match for `UnityEngine.Object.Destroy(UnityEngine.Object)' has some invalid arguments
Assets/NewBehaviourScript.cs(20,25): error CS1503: Argument
#1' cannot convertstring' expression to type `UnityEngine.Object'