Hello!
I ran into a problem lately and couldn’t find any solution using google. Sorry if this is a noob questen… but as said, couldn’t find anything anywhere not even a workaround.
In my app I have a dropdownbox which i populate with Gameobjects using tags. If an Object is chosen using the dropdownbox you can rotate it. Now I have a problem with the rotation target:
table.transform.Rotate(direction, degree)
Instead of the using something static “table.” I need this to be more dynamic. I can store the name of the chosen gameobject when I populate the dropdownbox but how can I call it with this variable? In this example NameVariable stores the name of the game object to be rotated.
ContentOfNameVariable.transform.Rotate(direction, degree)
Thank you for your advice!
EDIT: I use the following method to connect my Object with the script:
Inside the script I declare
public Text text;
public GameObject table;
public GameObject cube;
And the rotation:
public void rotation(Vector3 direction, float degree)
{
table.transform.Rotate(direction, degree);
}