Quick question, I have an action as shown below:
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.GameObject)]
[Tooltip("Gets all game objects within a given spherical radius and sends an event to them.")]
public class SendEventToGameObjectsWithinRadius : FsmStateAction
{
[RequiredField]
[Tooltip("The owner object.")]
public FsmOwnerDefault gameObject;
[UIHint(UIHint.FsmFloat)]
[Tooltip("The radius to search for objects within.")]
public FsmFloat radius;
[UIHint(UIHint.Tag)]
[Tooltip("Tagged objects to use.")]
public FsmString tag;
[RequiredField]
[Tooltip("Event to raise on objects.")]
public FsmEvent eventToRaise;
public override void Reset()
{
gameObject = null;
radius = 10.0f;
tag = string.Empty;
eventToRaise = null;
}
public override void OnEnter()
{
var underlyingGameObject = Fsm.GetOwnerDefaultTarget(gameObject);
IEnumerable<Collider> colliders = Physics.OverlapSphere(underlyingGameObject.transform.position, radius.Value);
if(!string.IsNullOrEmpty(tag.Value))
{ colliders = colliders.Where(x => x.tag.Equals(tag.Value)); }
foreach (var collider in colliders)
{
var fsmComponent = collider.GetComponent<PlayMakerFSM>();
if(fsmComponent != null) { fsmComponent.Event(eventToRaise); }
}
}
}
}
So basically find all elements of a given type near the owner object, and send an event to them. This is used in situations like an explosion happening and notifying nearby entities. As the event is not used on the owner object it seems like Playmaker does not like this and raises the error as titled. Now I can understand why it tells you this as in some cases you could be firing events that are not used, however I see this as a warning not an error, and in this case the event is used to relay to other objects. I have attached an image of the error.
So is there a way to stop this error from happening, as it seems like a legitimate use case.