I'm having a coin magnet script on each coin and when the Magnet Collider gets into the trigger zone of the coin I use a custom action to call a method on the script that basically sets a boolean to true so the coin can get attracted by the player. I also pass the Player Game Object to the script so it knows what transform.position it has to copy and move towards to.
The problem is: it never passes the Player Game Object and I can't find out what's the reason.
Here is the custom action I wrote:
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Collectible Magnet")]
[Tooltip("Calls the Method 'ActivateMagnetForce' in the CollectibleMagnet script.")]
public class ActivateMagnetForce : FsmStateAction
{
[Tooltip("The Game Object the CollectibleMagnet script is attached to. Example: a Coin.")]
public FsmOwnerDefault collectible;
[RequiredField]
[CheckForComponent(typeof(CollectibleMagnet))]
[Tooltip("The Game Object the collectible should be attracted to. Normally the Player.")]
public FsmGameObject targetObject;
public override void Reset()
{
collectible = new FsmOwnerDefault();
targetObject = new FsmGameObject();
}
public override void OnEnter()
{
Fsm.GetOwnerDefaultTarget(collectible).GetComponent<CollectibleMagnet>().ActivateMagnetForce(targetObject.Value);
Finish();
}
}
}
Here is the counterpart of the Magnet script:
//activated with the Playmaker Action "Activate Magnet Force"
public void ActivateMagnetForce(GameObject player)
{
Debug.Log("PM Action works!");
_player = player;
_targetTransform = player.transform;
_isCoinMoving = true;
}
And this is the error I get:

I also tried instead of FsmOwnerDefault to use FsmGameObject instead. Same problem though.
What am I doing wrong? Any help is appreciated.