2D Toolkit Forum

2D Toolkit => Support => Topic started by: rakkarage on June 16, 2014, 07:26:17 pm

Title: tk2dGrid in PropertyDrawer
Post by: rakkarage on June 16, 2014, 07:26:17 pm
why does the grid disappear after 1 second? thanks

TestGrid.cs

Code: [Select]
[Serializable]
public struct TestGrid
{
public int Unused;
}
Editor/TestGridEditor.cs

Code: [Select]
[CustomPropertyDrawer(typeof(DataGrid))]
public class TestGridEditor : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
tk2dGrid.Draw(position);
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
return EditorGUIUtility.singleLineHeight;
}
}
Title: Re: tk2dGrid in PropertyDrawer
Post by: rakkarage on June 16, 2014, 10:37:20 pm
"Unity has confirmed this is a bug and is working on a fix"
http://answers.unity3d.com/questions/377207/drawing-a-texture-in-a-custom-propertydrawer.html

or wrap the 'propertyDrawer' in an (even empty) 'editor'
Title: Re: tk2dGrid in PropertyDrawer
Post by: unikronsoftware on June 17, 2014, 10:25:07 am
Thanks for sharing that.