Var CollisionObject not working.

I want to select my collision object in the inspector so it would be easier.

This is the script I attached to my Capsule.

public var animationName : String;
public var collisionObject : GameObject;

function OnCollisionEnter(theCollision : Collision){

if( == collisionObject){



Why isn’t my animation playing when colliding? It does work when I fill in the collision object by hand.

Have you tried using triggers? I’m not sure if that would help but I always use them instead of collision codes, had a lot of problem with the OnCollisionEnter code when working with projectiles. Now I’m only using triggers and raycasting, they work perfectly fine.