Collision not detecting

Hey there!

I have this code running to check when the players sword hits an object and setting a variable (just to test) to log the hit. It’s not working though…

Here is the code:

var Damage : int;
var hits : int;

function onCollisionEnter(hit : Collision) {
	hits += 1;
	print("Detected collision between " + + " and " +;

For some reason this is not triggering the event it seems, the weapon has a box collider and has Is Trigger enabled.

Any solutions? Thanks in advance :slight_smile:

Write “OnCollisionEnter” function in capital “O” at start. This is one of built-in function in editor. It matters how you write this.