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

30 lines
739 B
C#

// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
// Thanks to James Murchison for the original version of this script.
using UnityEngine;
using HutongGames.PlayMaker;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Camera)]
[ActionTarget(typeof(Camera),"storeGameObject")]
[Tooltip("Gets the GameObject tagged MainCamera from the scene")]
public class GetMainCamera : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmGameObject storeGameObject;
public override void Reset ()
{
storeGameObject = null;
}
public override void OnEnter ()
{
storeGameObject.Value = Camera.main != null ? Camera.main.gameObject : null;
Finish();
}
}
}