LaboratoryProtection/Assets/UnityTest/EditorUITool/Scripts/Setter/GameobjectNameSetter.cs

34 lines
639 B
C#

using Cysharp.Threading.Tasks;
using PMaker.Extension;
using Sirenix.OdinInspector;
using System.Linq;
using UnityEngine;
public class GameobjectNameSetter : SetterBase<Transform, string>
{
#if UNITY_EDITOR
protected override void Set(Transform behaviour, string value)
{
behaviour.name = value;
}
[Button]
public override void GetBehaviours()
{
behaviours = this.transform.Children().ToArray();
}
[Button]
public void GetCurrentValue()
{
var strs = this.behaviours.Select(_ => _.name);
this.values = strs.ToArray();
this.SetDirty();
}
#endif
}