playMaker

Author Topic: Set FSM bool value from script while in edit mode?  (Read 1181 times)

BuddySystemGames

  • Playmaker Newbie
  • *
  • Posts: 3
Set FSM bool value from script while in edit mode?
« on: January 10, 2023, 03:15:12 PM »
Hello,
I'd like for the script below to change playmaker fsm values during edit mode. I'm using odin inspector for the inspector button, and I know that part works because the values do change to false in playmode, but they do not change while in edit mode. What do I need to do?

-----------------------------------

using System.Collections.Generic;
using UnityEngine;
using Sirenix.OdinInspector;

[ExecuteInEditMode]
public class ResetDefaults : MonoBehaviour
{
    public PlayMakerFSM sceneFSM;

    [Button(ButtonSizes.Large), GUIColor(0, 1, 0)]
    private void ResetDefaults()
    {
        sceneFSM.FsmVariables.GetFsmBool("No Previous Scene").Value = false;
        sceneFSM.FsmVariables.GetFsmBool("Skip Intro On Start").Value = false;
    }
}

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Set FSM bool value from script while in edit mode?
« Reply #1 on: January 11, 2023, 02:55:49 AM »
Hi.
Maybe You need to use a sceneFSM.SetDirty();

But if you have a little coding knowledge I would suggest to use Scriptable objects.

BuddySystemGames

  • Playmaker Newbie
  • *
  • Posts: 3
Re: Set FSM bool value from script while in edit mode?
« Reply #2 on: January 13, 2023, 04:54:29 PM »
Will try SetDirty() thanks!