Last active
November 4, 2017 00:36
-
-
Save gologius/d5bd52cc37a31321143502ffbca3cba7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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