Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class CustomWindow : EditorWindow
{
string charaName = "Animations";
//WIndow設定
[MenuItem("Window/CustomWindow")]
static void Open()
{
EditorWindow.GetWindow<CustomWindow>("Custom window");
}
void OnGUI()
{
printCustomLabel("パラメータ設定", Color.white, Color.black, 18);
savePath = EditorGUILayout.TextField("名前", savePath);
if (GUILayout.Button("生成"))
{
Debug.Log("Push");
}
}
//Label装飾用のラッパー
void printCustomLabel(string text, Color textColor, Color backColor, int fontSize, FontStyle fontStyle = FontStyle.Bold)
{
Color beforeBackColor = GUI.backgroundColor;
GUIStyle guiStyle = new GUIStyle();
GUIStyleState styleState = new GUIStyleState();
styleState.textColor = textColor;
styleState.background = Texture2D.whiteTexture;
GUI.backgroundColor = backColor;
guiStyle.normal = styleState;
guiStyle.fontSize = fontSize;
GUILayout.Label(text, guiStyle); //labelFieldだとうまくいかない?
GUI.backgroundColor = beforeBackColor;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment