Search code examples
c#unity-game-engineunity-editorunity3d-editor

Unable to find style '' in skin 'DarkSkin' Layout


Unity editor script is throwing this warning,

Unable to find style '' in skin 'DarkSkin' Layout

...and causing the styles on the editor to 'break'.

The editor script:

using UnityEditor;
using UnityEngine;

namespace ONCCK.PlayerModel
{
    [CustomEditor(typeof(PlayerModelMaker))]
    public class PlayerModelMakerEditor : Editor
    {
        private string _playerModelName;
        private string _playerModelDescription;

        public override void OnInspectorGUI()
        {
            PlayerModelMaker instance = (PlayerModelMaker)target;

            if (instance.PlayerModel == null)
                EditorGUILayout.HelpBox("Player model reference is null.", MessageType.Error);

            if (instance.HeadReference == null || instance.RightHandReference == null || instance.LeftHandReference == null)
                EditorGUILayout.HelpBox("Player model maker is not set up correctly!", MessageType.Error);

            // Descriptor
            EditorGUILayout.TextField("Player model name", _playerModelName);
            EditorGUILayout.TextArea("Player model description", _playerModelDescription); // Line 24. This is throwing the warning.

            base.OnInspectorGUI();

            EditorGUILayout.Space();

            // Buttons

            if (GUILayout.Button("Create avatar"))
                instance.Setup();

            if (GUILayout.Button("Align hands"))
                throw new System.NotImplementedException();
        }
    }
}

The console output:

enter image description here


Solution

  • TextArea doesn't have a label parameter. You can do something like

    EditorGUILayout.BeginHorizontal();
    EditorGUILayout.PrefixLabel("Player model description");
    _playerModelDescription = EditorGUILayout.TextArea(_playerModelDescription);
    EditorGUILayout.EndHorizontal();