Question about collision

I have an object with script that has a variable “number”.
And another object that has script and variable “num”, so the question is how on collision of this objects I can equate number and num? Thanks!

Maybe this works for you

 //Put this in the num Script

    void OnCollisionEnter(Collision col)
        	{
        		col.gameObject.SendMessage("equate",num,SendMessageOptions.DontRequireReceiver);
        	}
        
 //Put this in the number Script

    void equate(int num)
        	{
        		number = num;
        	}

Found information at http://docs.unity3d.com/Documentation/ScriptReference/index.Accessing_Other_Game_Objects.html .

This is my solution :slight_smile:
void OnCollisionEnter(Collision collider)
{
myName = collider.gameObject.GetComponent().name;

}