Search Unity

PropertyField doesn't use current GUI.skin

Discussion in 'Immediate Mode GUI (IMGUI)' started by Alex-Chouls, Mar 3, 2019.

  1. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Does anyone know if there's a way to get PropertyFields to use the current GUI.skin? It seems like they always use the default editor skin...?
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
  3. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Strange, I’ve been using GUI.skin in the editor for years!

    For example this works fine:

    Code (CSharp):
    1.  
    2. public override void OnInspectorGUI()
    3.     {
    4.         GUISkin origSkin = GUI.skin;
    5.         GUI.skin = mySkin
    6.    
    7.         //...
    8.         GUI.skin = origSkin;
    9. }
    But it doesn’t work with PropertyFields... so was wondering if there was a way to force them to use the current GUI.skin.
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,292
    What are you using in between that?
    EditorGUI or GUI?
     
  5. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Mainly EditorGUI, but I think the occasional GUI (e.g. for buttons).
     
  6. MrMatthias

    MrMatthias

    Joined:
    Sep 18, 2012
    Posts:
    191
    did you find a way?
     
  7. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663