Skip to content

Instantly share code, notes, and snippets.

@gologius
Last active November 4, 2017 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gologius/d5bd52cc37a31321143502ffbca3cba7 to your computer and use it in GitHub Desktop.
Save gologius/d5bd52cc37a31321143502ffbca3cba7 to your computer and use it in GitHub Desktop.
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