Answer the question
In order to leave comments, you need to log in
How to implement the change of objects for management?
Let's say I have a circle, a square, and a triangle on the same scene at the same time. And there is a script for moving the object. How to make it so that by clicking on the circle I control the circle, by clicking on the square - the square, and so on?
Answer the question
In order to leave comments, you need to log in
Throw a raycast from the middle of the screen to the desired target.
If the beam hit the object, then turn on its control. And do this for three objects. Of course, at the moment control is turned on for one object, control is turned off for all others.
As an alternative to the previous answer, you can use a trigger on the cursor to get the object.
And if each object has a separate button, you can control the required objects from the control object, on which the selection script is registered (provides a link to the object) and the control script (controls the required object).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question