Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Script Error: OnCollisionEnter2D

$
0
0
Hello, I'm having the weirdest problem in Unity 5.4.1f1 I have a 2 2D sprite which fall one onto another. Both have Rigidbody 2D & Box Collider 2D. On of them has the following script attached: using UnityEngine; using System.Collections; public class TestScript : MonoBehaviour { // Use this for initialization void Start() { } // Update is called once per frame void Update() { } void OnCollisionEnter2D(Collision2D col) { Debug.Log("TEST"); } } When compiling in VS - No errors appear. Unity, however, shows this message in the console: > Script error: OnCollisionEnter2D This> message parameter has to be of type: > The message will be ignored. And sure enough - The function isn't being called. When I double click the error it takes me to the OnCollisionEnter2D function, but I don't know what need I do to fix it. Can anyone see what's the problem here? Thanks Nitay

Viewing all articles
Browse latest Browse all 2891

Trending Articles