Hey there, I am looking to make a fairly complex animated GUI (2d) and I am wondering if someone has a technique for parenting with GUI.
eg. move object A and child object B moves under it. I know GUI elements aren’t objects at all, but is there some common workaround besides making game objects as a proxy GUI?
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Rect movingRect;
void Start() {
movingRect = new Rect(new Rect(Screen.width / 2 - 400, Screen.height / 2 - 300, 800, 600));
}
void OnGUI() {
GUI.Label(movingRect, "I'm Child Object A");
GUI.BeginGroup(movingRect);
GUI.Box(new Rect(0, 0, 800, 600), "This box is child object B and in you modify the movingRect var both with A will update position");
GUI.EndGroup();
}
}