Hi all
This works but is there a more efficient way?
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
using UnityEngine.UI;
using System;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.String)]
[Tooltip("Sets the value of a TextMesh Variable.")]
public class SetTextMeshValue : FsmStateAction
{
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmOwnerDefault gameObject;
public FsmString StringtoChange;
public bool everyFrame;
public override void Reset()
{
gameObject = null;
StringtoChange = null;
everyFrame = false;
}
public override void OnEnter()
{
DoSetStringValue();
if (!everyFrame)
Finish();
}
public override void OnUpdate()
{
DoSetStringValue();
}
void DoSetStringValue()
{
if (StringtoChange == null) return;
GameObject go = Fsm.GetOwnerDefaultTarget(gameObject);
go.GetComponent<TextMesh>().text = StringtoChange.Value;
}
}
}
Cheers
UB