Stumped, OnMouseDown

So I’ve a nonstatic function on a script I need to call from another script using OnMouseDown.

The Script containing the OnMouseDown function is just a simple call on a gameobject acting as a button.

This nonstatic function is reliant on variables on the script it’s on, it receives input and gives output on this script, so if I make it static it sort of isolates it from the script it’s on and renders it useless, all the variables I’ve declared on the script are ignored and it’s basically deaf to everything going on around it.

Is there any way I can call this function with an OnMouseDown on another script without marking the function static? Or can I call the OnMouseDown on the nonstatic function’s script and specify which button the OnMouseDown call needs to come from?

Sorry I’m sure I’ve worded this badly, my brain’s fried. Thanks for reading, any input you have is much appreciated!

Here’s the standard link about accessing other game objects; not entirely sure if that’s what you mean but anyway…http://unity3d.com/support/documentation/ScriptReference/index.Accessing_Other_Game_Objects.html

–Eric

Sure you can!

Read this and this.

I read it twice before I came up with your actual question which I believe is: “How do I access another script through OnMouseDown?”

Excellent! Thank you Dman and Eric I appreciate it!!