- Home /
Change object being affected by onPress() interaction,Apply functions attached to button to more than one object
I have a menu attached to the palm of my hand, which has some buttons that trigger some functions I coded (like rotation of an object around specific axis, for example). Those functions are applied to some objects in my scene. However, right now the menu functions are attached to only a few objects, but my intention is to have multiple objects, which trade place with each others, and have the menu change the target which is being affected by the functions.
In other words, and with the help of the pictures: I need the functions of my code "ModelRotation", that are currently attached to the object "FrameAnimation" to change dinamically, which means that the object "FrameAnimation" is going to change, but I need the menu to still be active, and to be able to choose to which object I want to apply the functions.
Is there a way to change the gameObject I dragged to the selected slot, and have the mene apply my functions to a new object?
that's only possible in editor scripts because it's a static reference. if you want to dynamically change the receiver, add the receiving function via code to the onclick function. some objects needs a reference to all possible recruiters and that menu button to link them and then can be responsible to remember which the current one is and be told to unlink the turns and link with the new one.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Illuminating a 3D object's edges OnMouseOver (script in c#)? 1 Answer
Can't figure out how to code equipment slots 1 Answer
event trigger error 0 Answers