Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - nickfourtimes

Pages: [1] 2
PlayMaker Bug Reporting / Re: Editor crash in 2018.3.2
« on: June 07, 2019, 02:49:22 PM »
We're seeing these crashes again in Unity 2018.4.1f1, PM 1.9.0.p16.

Unfortunately no solution on our end, what we ended up doing was "don't do this check unless a bug crops up and then do it manually."

I'll answer my own post here (again).

I finally found this guide a few days ago. Basically, if you're working on an instance of a prefab in a scene, you can change the variables (or drag-and-drop object references) and then hit apply, and the changes should be reflected in the prefab on disk.

However, if you're changing the structure of the FSM – adding or removing actions or events, reordering states or actions, that sort of thing – then you really should be working on the prefab itself, on disk. Easiest way to do that is to hit "Select" either in the PM editor inspector, or in the Unity inspector itself... at that point you'll be working directly on the prefab. Of course, in this case, you can't now refer to objects in the scene, but that's a general Unity constraint anyway.

Once I read this article and started using "Select" to work directly in the prefabs, we no longer had this issue where our changes to the prefab instance weren't being applied.

I've updated to 1.9.0p14 and it seems like it's been fixed for now, we'll be testing it to be sure.

Well, I don't quite understand how this got fixed, but it did.

One thing I noticed is that in the PM editor, the State tab would show "Prefab Instance (modified)" no matter how many times I hit "Apply" (both in the PM window and in the Unity inspector). If my FSM changes weren't being applied, that would explain why the spawned prefabs were spawning with the wrong variables used.

The only things I recognise having done were:
- I had a "Description" in one of my states, which I removed.
- I had a "Finish FSM" action in the last of my init states, which had a few other actions in it. I moved the Finish FSM action to a separate state all on its own.

I made these latter changes, then when I hit Apply the PM window simply showed "Prefab Instance" instead of "Prefab Instance (modified)," and the prefab was spawned properly in the game.

I've got an FSM in a prefab. On spawn, there's an init state that spawns some other stuff with the prefab. The state uses Create Object, and stores the object in a variable called spawnedObj. Then it uses Set Parent to set the parent of spawnedObj to itself (nesting the new object with the spawned prefab).

However, at runtime, when the prefab is spawned, I can inspect the instantiated prefab and see that the selection of GameObject variables has changed. In this case, say the FSM has many GameObject variables: spawnedObj, other1Obj, other2Obj, ...

Instead of Set Parent setting the parent of spawnedObj, as it is in the prefab, the action is now setting the parent of other1Obj (that is, in the Set Parent -> GameObject drop-down list, it's showing other1Obj).

Why would this happen?

Heya, I have a UI component that links to the UI components around it:

Code: [Select]
using UnityEngine;

public class MyComp : MonoBehaviour {
    public MyComp up;
    public MyComp down;
    public MyComp left;
    public MyComp right;

In my FSM, I have an Object variable set to MyComp type. What I want to do is use GetProperty to get, say, the "up" MyComp.

However, when I use the GetProperty action, the Property drop-down doesn't show up, down, left, or right as accessible variables. Am I making wrong assumptions about the GetProperty action, or is something not set up correctly?

Oh right, forgot that. We're on 1.9.0.p7.

This is a bit of a specific bug.

I'm noticing that if there's a Next Frame Event action in an FSM, and the PlayMaker editor is open, then when you hit Play, you can no longer click in any numerical field in the Inspector to edit it.

For instance, in Play mode, you can't click in the Transform component to type in new x, y, or z values. However, you can still click on the "X" label and drag it around and make changes that way, but this lacks the precision of simply typing a value into the float field.

When you exit Play mode, you can then click and type new values as usual. In addition, if you're in Play mode and close the PlayMaker editor, or remove the Next Frame Event, you can click and type in the fields again.

This is in Unity 2018.2.20f1 (our artist notices it in 13f1 as well). I have an empty project (with PM installed and a test scene) which reproduces the problem (~22MB).

PlayMaker Help / Re: Using FsmBoolField in a CustomActionEditor
« on: January 24, 2019, 03:57:24 PM »
Hm. So I've got an FsmBool wrapper:
Code: [Select]
using HutongGames.PlayMaker;

public class MyBool : FsmBool {

...and I've got an ObjectPropertyDrawer:
Code: [Select]
using HutongGames.PlayMakerEditor;
using UnityEditor;
using UnityEngine;

public class MyBoolEditor : ObjectPropertyDrawer {

    public override Object OnGUI(GUIContent label, Object obj, bool isSceneObject, params object[] attributes) {

        obj = EditorGUILayout.ObjectField(label, obj, typeof(MyBool), isSceneObject);

        GUILayout.Label("This is a custom object property drawer!");


        return obj;


...and within one of my custom actions, I have a MyBool variable:
Code: [Select]
public MyBool someBool;

However, in the inspector for the custom action, all I see is "Some Bool" and an empty space, without the GUI label that I expected to be shown. Am I setting things up incorrectly? I couldn't find much documentation besides this, though the C# example there seems to be missing.

Thanks for your continued patience.

PlayMaker Help / Re: Using FsmBoolField in a CustomActionEditor
« on: January 23, 2019, 11:30:44 AM »
Hm... that said though, I do want to be able to use the CustomActionEditor to like, show specific labels next to each FsmBool. So, for instance, instead of simply listing the FsmBools in the array as "Element 0," "Element 1," "Element 2," and so on, I could change the labels myself to read something like: "Event 0.52s," "Event 1.05s," "Event 6.92s" and so on.

PlayMaker Help / Re: Using FsmBoolField in a CustomActionEditor
« on: January 23, 2019, 11:19:37 AM »
To be honest, in the meantime I think I'll just go with your suggestion of creating ten FsmBools off the bat and letting the designer fill them out as necessary, it just seems to be a much more reliable solution.

PlayMaker Help / Re: Using FsmBoolField in a CustomActionEditor
« on: January 23, 2019, 11:17:06 AM »
This is my CustomAction (just a variant on SetAnimationTime, and I've omitted irrelevant code). Basically, if you give the action a particular AnimationClip, I want it to provide a number of FsmBools based on the number of AnimationEvents in the clip.

Code: [Select]
    [Tooltip("Sets the current Time of an Animation, Normalize time means 0 (start) to 1 (end); useful if you don't care about the exact time. Check Every Frame to update the time continuously. This variant provides a boolean for each AnimationEvent in the animation.")]
    public class MySetAnimationTime : BaseAnimationAction {

        public FsmGameObject animatingObject;

        [Tooltip("The animation clip to check for a tag.")]
        public FsmObject animationClip;

        public FsmFloat time;

        public FsmBool[] myBools;

        public bool normalized;
        public bool everyFrame;

        // for our drop-down stuff
        public int clipId;

        // ---------------------------------------------------------------------------------------- METHODS

        private void SetAnimationTime(GameObject go) {
            // same code as in SetAnimationTime

        // ---------------------------------------------------------------------------------------- FSM METHODS

        public override void Reset() {
            animatingObject = null;
            animationClip = null;
            time = null;
            normalized = false;
            everyFrame = false;
            initialised = false;
            myBools= new FsmBool[0];


        public override void OnEnter() {
            if(initialised) {
                // noop
            } else {


            if (!everyFrame) {


        public override void OnUpdate() {


And this is my CustomActionEditor:

Code: [Select]
public class MySetAnimationTimeEditor : CustomActionEditor {

    // -------------------------------------------------------------------------------------------- DATA MEMBERS
    // state
    GameObject prevObject;
    MySetAnimationTime mySetAnimTimeAction;

    // -------------------------------------------------------------------------------------------- METHODS

    void AnimationClipDropdown() {
        // code to choose an AnimationClip from the available clips on this Animation

    void ShowMyBooleans() {
        var numbools = 0;

        // get a list of all the events/tags in the animClip
        if(null != mySetAnimTimeAction.animationClip && null != ((AnimationClip)mySetAnimTimeAction.animationClip.Value).events) {
            var animClip = (AnimationClip)mySetAnimTimeAction.animationClip.Value;
            numbools =;

            // create the array of booleans on the target
            if (0 < numbools && (null == mySetAnimTimeAction.myBools || 0 == mySetAnimTimeAction.myBools.Length)) {
                mySetAnimTimeAction.myBools = new HutongGames.PlayMaker.FsmBool[numbools];
                for (int i=0; i < numbools; ++i) {
                    mySetAnimTimeAction.myBools[i] = new HutongGames.PlayMaker.FsmBool();

        // the label for all the snapping-point bools we're going to select from
        EditorGUILayout.LabelField("My Bools");

        // show each of the FsmBools
        for(int i=0; i < numbools; ++i) {

            if (null == mySetAnimTimeAction.Fsm) {
                Debug.LogWarning("no fsm");
            } else if (null == mySetAnimTimeAction.myBools[i]) {
                Debug.LogWarning("bad eleement " + i);
            } else {
                mySetAnimTimeAction.myBools[i] =
                    HutongGames.PlayMakerEditor.VariableEditor.FsmBoolField(new GUIContent("Event " + i), mySetAnimTimeAction.Fsm, mySetAnimTimeAction.myBools[i]);


    // -------------------------------------------------------------------------------------------- GUI METHODS

    public override bool OnGUI() {
        mySetAnimTimeAction = (MySetAnimationTime)target;






        return GUI.changed;

Probably making all sorts of mistakes here, but I couldn't find any other examples of this use case online.

PlayMaker Help / Using FsmBoolField in a CustomActionEditor
« on: January 22, 2019, 04:22:33 PM »

I've got an action, and it may require a variable number of FsmBools. In my CustomActionEditor, I'm doing the following:

Code: [Select]
public override bool OnGUI() {

    // show an FsmBool for each required bool
    for(int i=0; i < numbools; ++i) {

        if (null == baseAction.Fsm) {
            Debug.LogWarning("no fsm");
        } else if (null == baseAction.bools[i]) {
            Debug.LogWarning("bad element " + i);
        } else {
            baseAction.bools[i] =
                HutongGames.PlayMakerEditor.VariableEditor.FsmBoolField(new GUIContent("Bool " + i), baseAction.Fsm, baseAction.bools[i]);

However, the assignment to baseAction.bools[ i ] doesn't seem to work. You can select an FSM variable in the drop-down list, but when you select it, the action doesn't seem to retain that boolean variable.

Am I using FsmBoolField() incorrectly?

PlayMaker Bug Reporting / Re: Editor crash in 2018.3.2
« on: January 22, 2019, 11:34:25 AM »
Hm... I mean I guess it's hard to say, particularly since it happens often on one computer but very rarely on another. As I mentioned it seems to happen on entering or exiting Play mode, or on quitting the editor; possibly it's caused by prefab (de)serialisation.

I'll test a bit more; I know we had a similar spate of crashes when we would have the PM window open. In that case, I think it was a matter of changing our .NET runtime to v4, but we've tried all variants of that in 2018.3 and had no luck. I haven't extended PM that much; maybe about ten custom actions, and those tend to be copies of existing ones, while the corresponding editors are just copy-pasted code from other CustomAction editors.

I did create my own SetPropertyEditor for the basic SetProperty action. It's a bit of a quality-of-life extension: if we use SetProperty on another PlayMakerFSM object, the action itself will show the name of the other FSM (so we know which one it is if we're referencing an object with many FSMs on it); and if it's changing the property on a component, in a GameObject with multiple such components, it'll show the number of the component ("Nth out of M"), so we'll similarly know which component is being affected. Really don't know how this would cause the crash though.

Pages: [1] 2