hi, sorry for my english
my question is: can i have two differently “OnMouseDown functions” in the same object?
if yes, how?
for example:
ty
hi, sorry for my english
my question is: can i have two differently “OnMouseDown functions” in the same object?
if yes, how?
for example:
ty
Firstly you should use MouseButtonDown
And if you want to detect multiple touch use Input.Touch…
Say you can click on a bomb to either explode it, or to pick it up. How will the computer know which one they want to do? Once you figure that out, you can program it.
Exs: suppose shift-click picks it up. Then check for the shift key in mouseDown. Suppose you have to pick it up, plant it, then blow it up. Start each bomb’s planted=false, set to true when you plant it, and have mouseDown explode only if planted=true.
What you want to do is place the if-clauses inside the OnMouseDown() function. This way you only need 1
function OnMouseDown()
{
if (attivamazzoSM == true)
{
dadoFtrigger.TurnoF = true;
dado44obj.renderer.enabled = true
}
if (greenarrow == true)
{
dadomantrigg.TurnoM = true;
dado11obj.renderer.enabled = false;
}
}
To get the attivamazzoSM and the greenarrow bools to work, you need to make them fields in your class.
tnx a lot to all, problem solved