Last active
August 29, 2015 14:27
-
-
Save tsubaki/3b3dbc8fac93db7dcf6f to your computer and use it in GitHub Desktop.
ネストクラス(ScriptableObject)
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; | |
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