您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
33 行
1.2 KiB
33 行
1.2 KiB
using UnityEngine;
|
|
using UnityEditor;
|
|
using System.Collections.Generic;
|
|
using System.Collections;
|
|
|
|
[CustomEditor(typeof(LightProbesVolumeSettings))]
|
|
public class LightProbesVolumeEditor : Editor
|
|
{
|
|
public override void OnInspectorGUI()
|
|
{
|
|
EditorGUI.BeginChangeCheck();
|
|
var volume = (LightProbesVolumeSettings)target;
|
|
base.DrawDefaultInspector();
|
|
if (GUILayout.Button("Create Light Probes in Selected Volume"))
|
|
{
|
|
volume.Populate();
|
|
}
|
|
}
|
|
|
|
[MenuItem("GameObject/Light/Lightprobes Volume", false, 10)]
|
|
static void CreateCustomGameObject(MenuCommand menuCommand)
|
|
{
|
|
// Create a custom game object
|
|
GameObject volume = new GameObject("LightprobeVolume");
|
|
// Ensure it gets reparented if this was a context click (otherwise does nothing)
|
|
GameObjectUtility.SetParentAndAlign(volume, menuCommand.context as GameObject);
|
|
// Register the creation in the undo system
|
|
Undo.RegisterCreatedObjectUndo(volume, "Create " + volume.name);
|
|
Selection.activeObject = volume;
|
|
volume.AddComponent<LightProbesVolumeSettings>();
|
|
volume.GetComponent<BoxCollider>().size = new Vector3(5, 2, 5);
|
|
}
|
|
}
|