diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 808714d..986a95c 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -605,13 +605,16 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1867692259} + - component: {fileID: 1867692262} + - component: {fileID: 1867692261} + - component: {fileID: 1867692260} m_Layer: 5 m_Name: SampleChild m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &1867692259 RectTransform: m_ObjectHideFlags: 0 @@ -631,6 +634,57 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1867692260 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1867692258} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1867692261 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1867692258} + m_CullTransparentMesh: 1 +--- !u!114 &1867692262 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1867692258} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5a14e8386dd24e3793287ff572cb78f8, type: 3} + m_Name: + m_EditorClassIdentifier: + k__BackingField: {fileID: 1867692260} --- !u!1 &2038986851 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/WindowBase.cs b/Assets/Scripts/WindowBase.cs index 74ad819..060ecf3 100644 --- a/Assets/Scripts/WindowBase.cs +++ b/Assets/Scripts/WindowBase.cs @@ -4,6 +4,8 @@ namespace InterfaceOff { public abstract class WindowBase : MonoBehaviour { + public WindowComponents Components { get; set; } + public void InstantiateWindowBase() { } diff --git a/Assets/Scripts/WindowComponents.cs b/Assets/Scripts/WindowComponents.cs new file mode 100644 index 0000000..39d0b82 --- /dev/null +++ b/Assets/Scripts/WindowComponents.cs @@ -0,0 +1,10 @@ +using UnityEngine; +using UnityEngine.UI; + +namespace InterfaceOff +{ + public class WindowComponents : MonoBehaviour + { + [field: SerializeField] public Image WindowImage { get; private set; } + } +} \ No newline at end of file diff --git a/Assets/Scripts/WindowComponents.cs.meta b/Assets/Scripts/WindowComponents.cs.meta new file mode 100644 index 0000000..a82d395 --- /dev/null +++ b/Assets/Scripts/WindowComponents.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5a14e8386dd24e3793287ff572cb78f8 +timeCreated: 1768300161 \ No newline at end of file diff --git a/Assets/Scripts/WindowSpawner.cs b/Assets/Scripts/WindowSpawner.cs index 4ef5a92..cb9f866 100644 --- a/Assets/Scripts/WindowSpawner.cs +++ b/Assets/Scripts/WindowSpawner.cs @@ -36,15 +36,18 @@ namespace InterfaceOff if (Input.GetKeyDown(KeyCode.Space)) { GameObject go = Instantiate(SampleChild, GameCanvas.transform); - Type type = WindowTypes.GetRandom(); + go.SetActive(true); + Type type = WindowTypes.GetRandom(); WindowBase windowBase = go.AddComponent(type) as WindowBase; + if (DebugUtils.IsNull(windowBase)) { Debug.LogError("How did this happen"); return; } + windowBase.Components = go.GetComponent(); windowBase.InstantiateWindowBase(); } }