Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Last active August 29, 2015 14:27
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 tsubaki/3b3dbc8fac93db7dcf6f to your computer and use it in GitHub Desktop.
Save tsubaki/3b3dbc8fac93db7dcf6f to your computer and use it in GitHub Desktop.
ネストクラス(ScriptableObject)
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.Linq;
[CreateAssetMenu( menuName = "ScriptableObject/EditorAction", fileName="EditorAction")]
public class FindLight : ScriptableObject
{
[SerializeField] LightType lighttype = LightType.Directional;
private void Find()
{
var lights = GameObject
.FindObjectsOfType<Light> ()
.Where (c => c.type == lighttype)
.Select (c => c.gameObject)
.ToArray ();
Selection.objects = lights;
}
[CustomEditor(typeof(FindLight))]
class FindLightEditor : Editor
{
public override void OnInspectorGUI ()
{
base.OnInspectorGUI ();
if( GUILayout.Button("Action")){
Instance.Find();
}
}
FindLight Instance
{
get{ return (FindLight)target; }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment