/// <summary> /// creates an object-trakcing UI element /// </summary> /// <returns>The trackable UIE lement.</returns> /// <param name="windowScheme">Window scheme.</param> /// <param name="objectToTrack">Object to track.</param> public GameObject CreateTrackableWindow(WindowSchematic windowScheme, GameObject objectToTrack) { GameObject newTrackableWindow = Instantiate(windowStarter[(int)windowScheme.type], windowTrackingLayer); TrackableUIElement component = newTrackableWindow.GetComponent <TrackableUIElement>(); foreach (GameObject obj in windowScheme.uiObjects) { GameObject.Instantiate(obj, component.contents); } newTrackableWindow.GetComponent <TrackableUIElement>().StartTracking(objectToTrack); return(newTrackableWindow); }
/// <summary> /// this function is responsible for creating the various window it is passed /// </summary> /// <param name="windowScheme">Window scheme.</param> public GameObject CreateWindow(WindowSchematic windowScheme) { Debug.Log($"Creating the window {windowScheme.windowName}"); // chose which window we're using GameObject window = Instantiate(windowStarter[(int)windowScheme.type], this.transform); WindowContainer component = window.GetComponent <WindowContainer>(); foreach (GameObject obj in windowScheme.uiObjects) { GameObject.Instantiate(obj, component.content); } component.ShowThisWindow(windowScheme.ScreenOrder); return(window); }