Thanks to the user MelvMay i got this script working … really simple stuff … but what i am concerned is that in the exact moment i turned my “Ball” object to be a prefab this script was no longer working!
Why is that? How to fix it?
I know it is explained somewhere on the API or Manual … But i am not an english native speaker and finding Very-Specific things like this is sometimes difficult!
Thanks for any help!!
using UnityEngine;
using System.Collections;
public class InfoHolder : MonoBehaviour {
public GameObject ball;
void OnCollisionEnter2D(Collision2D collision){
if(collision.gameObject == ball){
Debug.Log (ball.GetComponent<Rigidbody2D>().velocity);
}
}
}