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
/// <summary> | |
/// https://gist.github.com/4243887 | |
/// http://anchan828.tumblr.com/post/37544410340 | |
/// </summary> | |
using UnityEngine; | |
using UnityEditor; | |
using System.Linq; | |
using System.Collections.Generic; | |
using System; |
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 UnityEngine; | |
/// <summary> | |
/// <para>通常使うスクリプトファイル。ゲームオブジェクトにアタッチすればインスペクターに表示される</para> | |
/// <para>今回は既にあるRangeAttributeを自作します。</para> | |
/// </summary> | |
public class Example : MonoBehaviour | |
{ | |
/// <summary> | |
/// 0から10までしか設定することの出来ないスライダーを作成します。 |
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 UnityEngine; | |
public class SceneAttribute : PropertyAttribute | |
{ | |
public int selectedValue = 0; | |
public SceneAttribute () | |
{ | |
} | |
} |
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 UnityEngine; | |
using System.Collections; | |
public class SampleScript : MonoBehaviour { | |
public float hp; | |
void Update() | |
{ | |
Debug.Log( hp ); |
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 UnityEngine; | |
using System.Collections; | |
[RequireComponent(typeof(Animator))] | |
[RequireComponent(typeof(CharacterController))] | |
public class RobotController : MonoBehaviour | |
{ | |
private Animator animator; | |
private CharacterController characterController; |
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
/// <summary> | |
/// Unity RichText Extensions. | |
/// http://docs.unity3d.com/Documentation/Manual/StyledText.html | |
/// </summary> | |
namespace UnityExtensions.Text | |
{ | |
public static class RichTextExtension | |
{ | |
public static string Large (this string text) | |
{ |
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
public class Asset | |
{ | |
public static void Save <T> (T asset) where T : ScriptableObject | |
{ | |
Directory.CreateDirectory (DeployGateUtility.settingsFolderPath); | |
string assetPath = DeployGateUtility.settingsFolderPath + typeof(T).Name + ".asset"; | |
T _asset = (T)AssetDatabase.LoadAssetAtPath (assetPath, typeof(T)); | |
if (_asset == null) | |
AssetDatabase.CreateAsset (asset, assetPath); | |
AssetDatabase.SaveAssets (); |
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 UnityEngine; | |
using UnityEditor; | |
using System.Collections; | |
using System.Reflection; | |
public class HogeSearchableEditorWindow : SearchableEditorWindow | |
{ | |
static SearchableEditorWindow window = null; | |
[MenuItem("Window/HogeSearchableEditorWindow #%p")] |
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
//参考: http://wiki.unity3d.com/index.php?title=Singleton | |
using UnityEngine; | |
public abstract class MonoSingleton<T> : MonoBehaviour where T : MonoSingleton<T> | |
{ | |
private static T instance = null; | |
public static T Instance { | |
get { | |
//Scene内にあったら取得 |
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 UnityEngine; | |
using UnityEditor; | |
[CustomEditor(typeof(HogeScript))] | |
public class CompactWindow : Editor | |
{ | |
private Editor model; | |
public override void OnInspectorGUI () | |
{ | |
HogeScript h = (HogeScript)target; |