// Modify display method public override void OnBodyGUI() { if (_basicTileNode == null) { _basicTileNode = (BasicTileNode)target; } // Specifying the update method onUpdateNode = NodeUpdate; serializedObject.Update(); // Not needed can use TileNode field //SerializedProperty sp = serializedObject.FindProperty("tile"); //Tile tile = (Tile) sp.objectReferenceValue; //sp.objectReferenceValue = EditorGUILayout.ObjectField("Tile", tile, typeof(Tile), false); // Specific unity object picker for tile _basicTileNode.tile = (Tile)EditorGUILayout.ObjectField("Tile", _basicTileNode.tile, typeof(Tile), false, GUILayout.ExpandWidth(true)); // Refresh image preview if (_basicTileNode.tile != null) { LoadTexture(_basicTileNode.tile.sprite); } if (_tileImg != null) { EditorGUILayout.LabelField(new GUIContent(_tileImg)); } NodeEditorGUILayout.PropertyField(serializedObject.FindProperty("tile")); serializedObject.ApplyModifiedProperties(); }
public override void OnCreate() { if (_basicTileNode == null) { _basicTileNode = (BasicTileNode)target; } if (_basicTileNode.tile != null) { LoadTexture(_basicTileNode.tile.sprite); } }