Made children randomly spawn

This commit is contained in:
Pasha Bibko
2026-01-13 10:42:09 +00:00
parent e700523706
commit 37e4ee8273
5 changed files with 52 additions and 0 deletions

View File

@@ -35,12 +35,14 @@ namespace InterfaceOff
{
if (Input.GetKeyDown(KeyCode.Space))
{
/* Creates the gameobject with a random class */
GameObject go = Instantiate(SampleChild, GameCanvas.transform);
go.SetActive(true);
Type type = WindowTypes.GetRandom();
WindowBase windowBase = go.AddComponent(type) as WindowBase;
/* Checks it created correctly before instantiating further */
if (DebugUtils.IsNull(windowBase))
{
Debug.LogError("How did this happen");