internal CcNode(Tree tree, BGCc cc) : base(tree) { Cc = cc; descriptor = cc.Descriptor; var editor = UnityEditor.Editor.CreateEditor(cc); if (!(editor is BGCcEditor)) { throw new BGCc.CcException("Unable to init an Editor for " + cc.GetType() + ": editor does not extend from BGCcEditor."); } ccEditor = (BGCcEditor)editor; ccEditor.ChangedParent += ChangedParent; // UnityEditor.Editor.CreateCachedEditor(cc, null, ref ccEditor); onSceneGuiMethod = ccEditor.GetType().GetMethod("OnSceneGUI", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); enabledTexture = BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGTickYes123); disabledTexture = BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGTickNo123); helpTexture = BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGHelp123); deleteTexture = BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGDelete123); addTexture = BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGAdd123); changeNameTexture = BGEditorUtility.LoadTexture2D(BGEditorUtility.Image.BGCcEditName123); parentType = cc.GetParentClass(); }
internal CcNode(Tree tree, BGCc cc) : base(tree) { Cc = cc; descriptor = cc.Descriptor; var editor = UnityEditor.Editor.CreateEditor(cc); if (!(editor is BGCcEditor)) { throw new BGCc.CcException("Unable to init an Editor for " + cc.GetType() + ": editor does not extend from BGCcEditor."); } ccEditor = (BGCcEditor)editor; ccEditor.ChangedParent += ChangedParent; // UnityEditor.Editor.CreateCachedEditor(cc, null, ref ccEditor); onSceneGuiMethod = ccEditor.GetType().GetMethod("OnSceneGUI", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); parentType = cc.GetParentClass(); }