private void loadTreeNode(TreeNodeDefinition nodeDefinition, GameObject parent) { if (nodeDefinition != null) { GameObject gameObject = nodeDefinition.CreateInstance(); if (gameObject != null) { gameObject.transform.SetParent(parent.transform, worldPositionStays: false); gameObject.name = nodeDefinition.name; if (this.OnNodeLoaded != null) { this.OnNodeLoaded(gameObject); } TreeNodeDefinition[] childNodes = nodeDefinition.GetChildNodes(); for (int i = 0; i < nodeDefinition.GetChildNodes().Length; i++) { loadTreeNode(childNodes[i], gameObject); } } else { Log.LogErrorFormatted(this, "Node GameObject for node {0} was null", nodeDefinition.name); } } else { Log.LogErrorFormatted(this, "Node definition was null under parent {0}", parent.name); } }
protected void onContentKeyLoaded(string path, TreeNodeDefinition nodeDefinition) { this.OnContentLoaded.InvokeSafe(this); if (this != null && base.gameObject.activeInHierarchy) { loadTreeNode(nodeDefinition, base.gameObject); } }