Files
beyond/Assets/ThirdParty/PlayMaker/Actions/UI/EventSystem/UiSetSelectedGameObject.cs
2024-11-20 15:21:28 +01:00

36 lines
766 B
C#

// (c) Copyright HutongGames, LLC 2010-2018. All rights reserved.
// http://hutonggames.com/playmakerforum/index.php?topic=8452
using UnityEngine.EventSystems;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.UI)]
[Tooltip("Sets the EventSystem's currently select GameObject.")]
public class UiSetSelectedGameObject : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
[Tooltip("The GameObject to select.")]
public FsmGameObject gameObject;
public override void Reset()
{
gameObject = null;
}
public override void OnEnter()
{
DoSetSelectedGameObject();
Finish();
}
private void DoSetSelectedGameObject()
{
EventSystem.current.SetSelectedGameObject (gameObject.Value);
}
}
}