ソースコード
using System;
using UnityEditor;
using UnityEngine;
[CustomEditor( typeof( ParticleSystem ) )]
public sealed class ParticleSystemInspector : Editor
{
private static readonly Type BASE_EDITOR_TYPE = typeof( Editor )
.Assembly
.GetType( "UnityEditor.ParticleSystemInspector" );
public override void OnInspectorGUI()
{
var particleSystem = ( ParticleSystem ) target;
using ( new EditorGUILayout.HorizontalScope() )
{
if ( GUILayout.Button( "Play" ) )
{
particleSystem.Play();
}
if ( GUILayout.Button( "Stop" ) )
{
particleSystem.Stop();
}
if ( GUILayout.Button( "Pause" ) )
{
particleSystem.Pause();
}
if ( GUILayout.Button( "Clear" ) )
{
particleSystem.Clear();
}
}
var editor = CreateEditor( particleSystem, BASE_EDITOR_TYPE );
editor.OnInspectorGUI();
}
}
使用例
![f:id:baba_s:20220216184622p:plain](https://cdn-ak.f.st-hatena.com/images/fotolife/b/baba_s/20220216/20220216184622.png)