It was a super quick edit from me but I needed to get a tag count and do maths with it, the action currently was an INT so I changed a few lines to make it a float. Figured I'd mention it here, maybe it can be added later or something.
// (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.GameObject)]
[Tooltip("Gets the number of Game Objects in the scene with the specified Tag. Uses Float")]
public class GetTagCountFloat : FsmStateAction
{
[UIHint(UIHint.Tag)]
public FsmString tag;
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmFloat storeResult;
public override void Reset()
{
tag = "Untagged";
storeResult = null;
}
public override void OnEnter()
{
GameObject[] gos = GameObject.FindGameObjectsWithTag(tag.Value);
if (storeResult != null)
storeResult.Value = gos != null ? gos.Length : 0;
Finish();
}
}
}
My reason for this was that I needed to get a count of every star in my scene, "StarCount" and then compare with the amount of stars collected at the end of the level "StarsCollected" so I could work out a percentage at the end of how many the player collected (StarsCollected / StartCount x 100). I couldn't do this with an INT.