Hello Guest

Author Topic: tk2dGrid in PropertyDrawer  (Read 4968 times)

rakkarage

  • Newbie
  • *
  • Posts: 12
    • View Profile
tk2dGrid in PropertyDrawer
« 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;
}
}

rakkarage

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: tk2dGrid in PropertyDrawer
« Reply #1 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'
« Last Edit: June 16, 2014, 10:48:17 pm by rakkarage »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dGrid in PropertyDrawer
« Reply #2 on: June 17, 2014, 10:25:07 am »
Thanks for sharing that.