void SpawnUIElement(DevUIElement devUIElement) { //Spawn and initialize by type if (devUIElement is DevUILUAButton) { SpawnLuaButton(devUIElement as DevUILUAButton, false); } else if (devUIElement is DevUIButton) { SpawnButton(devUIElement as DevUIButton); } else if (devUIElement is DevUIToggle) { SpawnToggle(devUIElement as DevUIToggle); } else if (devUIElement is DevUILuaExpression) { SpawnLuaExpression(devUIElement as DevUILuaExpression, false); } else if (devUIElement is DevUIKeyValue) { SpawnKeyValueOutput(devUIElement as DevUIKeyValue); } else { Debug.LogWarning("Tried to spawn a UI element that has no prefab for view!"); } }
void RemoveUIElement(DevUIElement element) { if (uiElements.ContainsKey(element)) { Destroy(uiElements[element].gameObject); uiElements.Remove(element); } }