Unity3d OnCollisionEnter not firing

I made a simple script to detect collisions, but it doesn’t appear to be working. The collision doesn’t seem to be acknowledged whatsoever.

using UnityEngine;
    using System.Collections;    
    public class Pickup : MonoBehaviour {
    	// Update is called once per frame
    	void onCollisionEnterEnter (Collision col){
    		if(col.transform.tag.Contains("Weapon")){
    			Debug.Log ("Poke");
    		}
    	}
    }

Both the objects have colliders and rigidbodies. I cant seem to figure out why this isnt working. onTriggerEnter doesnt work either, even if one of the objects is set to be a trigger.

object to collide with-

character-
http://imgur.com/1FmftmT

If you have any IMaterialModifier objects (e.g., Masks) acting on the component, then the material actually submitted to the renderer may not be the same as the default one specified.

1 Answer

1

Your on collision enter function isnt capitalized replace onCollisionEnter with OnCollisionEnter

Thanks, That was really stupid of me ^^; Sometimes it takes a fresh set of eyes to notice the little things

It should also be noted that while using this method, you still need to instantiate the material at start, or else they will continue to edit the base material. This may not always be an issue, but it is far from ideal, so save yourselves the headaches and instance those materials in advance.