How to get a Read-Write Reference to Parent GameObject from a script component attached to it?
- by onguarde
I have a game object(object) with a script component(myscript) attached.
I have a reference to myscript component through getComponent, and I want to change the transform of the gameObject the script is attached to.
myscript.gameObject.transform = (new value);
The above code gives me error,
Property 'UnityEngine.GameObject.transform' is read only.
Is there a way to get a read-write version?