[URGENT!!!] OnCollisionEnter is not working; need help to figure out if I've missed something or if it's a Unity 5 bug.

Hi all,

I’m having trouble getting OnCollisionEnter() to record a collision (code below). I’ve used OnCollisionEnter() before and for the life of me can’t think what’s gone wrong this time. I need help deciding if it’s user error on my part or if this is a common issue with Unity5. Also I would prefer to avoid having to use OnTriggerEnter() on this occasion if possible.

Now we’ve got the production deadline fast approaching and with time running out I’m open to any and every suggestion. Whoever helps me resolve this issue, if they’re interested, has earned a Steam Key after release.

Okay now for the details:

using UnityEngine;
using System.Collections;

public class ColSparks : MonoBehaviour 
{
	private void OnCollisonEnter (Collision other)
	{
		print ("Collision Detected");	
	}
}

The GameObject detecting the collision

  • Script is attached to the GameObject.

  • gameObject has Rigidbody && SphereCollider components attached.

  • Rigidbody is NOT kinematic.

  • SphereCollider is NOT set as Trigger.

The other.gameObject

  • gameObject has BoxCollider component attached.
  • BoxCollider is NOT set as trigger.

Extra Info

  • Their respective physics layers are set to interact with one and other.

  • Similar set-up used successfully in another scene (note this was being tested in a Debug environment so no conflicts would occur).

  • Entire project is C#

  • The script has been stripped back for debugging in order to try and print() the collision to check it works.

Many thanks in advance! I look forward to hearing your ideas.

Ross

Noob4Sale · 5 hours ago 2 Reply Share

If the script above is the exact same
as in your project,you misspelt
OnCollisionEnter.

Big thanks to the eagle eyed Noob4Sale :slight_smile: