You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/Feel/MMTools/Editor/MMUtilities/MMTransformRandomizerEditor.cs

36 lines
859 B
C#

1 month ago
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
namespace MoreMountains.Tools
{
/// <summary>
/// Custom editor for the MMTransformRandomizer class
/// </summary>
[CustomEditor(typeof(MMTransformRandomizer), true)]
[CanEditMultipleObjects]
public class MMTransformRandomizerEditor : Editor
{
/// <summary>
/// On inspector we handle undo and display a test button
/// </summary>
public override void OnInspectorGUI()
{
serializedObject.Update();
Undo.RecordObject(target, "Modified MMTransformRandomizer");
DrawDefaultInspector();
EditorGUILayout.Space();
EditorGUILayout.LabelField("Test", EditorStyles.boldLabel);
if (GUILayout.Button("Randomize"))
{
foreach (MMTransformRandomizer randomizer in targets)
{
randomizer.Randomize();
}
}
}
}
}