I’m a beginner in unity3d, I’m just reading and watching tutorials to learn. I’m using C#. I found: to check that the object have collided with any other object, I have to make this function: “void OnCollisionEnter();”, But when i wrote it nothing happened. Although I read that this function has to be called when this object collide with another but nothing happen but I think it wasn’t called during playing.
Here’s my code please tell me what should i do?? :((
using UnityEngine;
using System.Collections;
public class move2 : MonoBehaviour {
public float speed = -2.0f;
// Use this for initialization
void OnCollisionEnter(Collision collision)
{
Debug.Log("hit!");
}
// Update is called once per frame
void Update ()
{
transform.Translate(0,Time.deltaTime…
transform.Translate(Time.deltaTime*s…
}
}