Pragma Strict work around for colliders?

What is the work around for colliders when using Pragma Strict?

Right now I have:

#pragma strict

function OnCollisionStay(other)
{
     if(other.gameObject == GameObject.Find("<ObjectName>"))
     {
     }
}

I get an error saying, “gameObject is not a member of Object”. When I delete the “#pragma strict” the error goes away. How should this be written out?

Thanks!

It’s not colliders specifically; always specify the type of variables. You haven’t defined the type for “other”.

–Eric

I’m not sure what you mean?

Like:

function OnCollisionStay(collisionInfo : other)
{
}

?

I thought the “other” would be assigned the info (collisionInfo: gameObject, collider, rigidbody, transform, relativeVelocity and contacts) as soon as the object with that script hits another object with a rigidbody/collider?

No, you have to define the type, as shown in the docs.

It is, but that’s something that happens at runtime, so it doesn’t help at all when the script is compiled. You must always define the type for variables, either explicitly, or implicitly by supplying a value. But you can’t supply a value for function parameters, so the only option is to declare the type explicitly.

–Eric

Awesome. That seemed to do it. Thanks!

I just need to keep in mind to fully define my variables.