I want to have a script attached to a gameobject and rotate the gameobject with it.
I want to initiate the gameobject from a different script (while the instance rotate automatically)
what is the easiest way to get the gameobject the script is attached to (from inside the rotating script)? (c#)
Literally gameObject. You want transform for rotation and stuff.
public class Rotate : MonoBehaviour
{
private void Update()
{
gameObject.name = "Been up for " + Time.realtimeSinceStartup;
transform.position += Vector3.up;
}
}
That would be the easiest way, consider watching the nice basic tutorials for Unity.