static public Block Create(Wiring.BlockBase runtimeInstance, Type renderer, Graph g) { var Block = CreateInstance(renderer) as Block; Block.Initialize(runtimeInstance, g); return(Block); }
// Initializer (called from the Create method) protected virtual void Initialize(Wiring.BlockBase runtimeInstance, Graph g) { hideFlags = HideFlags.DontSave; // Object references _runtimeInstance = runtimeInstance; _runtimeInstance.title = _runtimeInstance.name; _serializedObject = new UnityEditor.SerializedObject(runtimeInstance); _serializedPosition = _serializedObject.FindProperty("_wiringNodePosition"); // Basic information name = runtimeInstance.GetInstanceID().ToString(); position = new Rect(_serializedPosition.vector2Value, Vector2.zero); _attrs = PopulateAttrs <ModelBlockAttribute>(_runtimeInstance) as ModelBlockAttribute; // Slot initialization PopulateSlots(); }