Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Skyline on January 06, 2021, 07:14:41 PM

Title: Need help connecting to FSM to send event from C# script
Post by: Skyline on January 06, 2021, 07:14:41 PM
Hello, I got a plugin from unity asset store, but I don't know how to code.
I thought i'd try using playmaker to connect to the code.
following the advice from another post to send event to fsm directly, I copied this from another post on this forum to send event directly to fsm.
Code: [Select]
GoFsm = GameObject.GetComponent<PlayMakerFSM>();
                GoFsm.SendEvent("TheEvent");
but I don't know if i pasted in the right place. It's not working...Where do I put that code so it fires in this function?

Code: [Select]
    public void DestroyItem(bool showScore = false, bool particles = true, Item explodedItem = null, bool explEffect = false)
        {
            if (!gameObject.activeSelf) return;
            if (square.type == SquareTypes.WireBlock)
            {
                GoFsm = GameObject.GetComponent<PlayMakerFSM>();
                GoFsm.SendEvent("TheEvent");

                square.DestroyBlock();
                StopDestroy();
                return;
            }