playMaker

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.


Topics - nickfourtimes

Pages: [1]
1
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?

2
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?

3
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).

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

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() {
    ...
    EditorGUILayout.BeginHorizontal();
    EditorGUILayout.LabelField("Bools");
    EditorGUILayout.EndHorizontal();

    // show an FsmBool for each required bool
    ++EditorGUI.indentLevel;
    for(int i=0; i < numbools; ++i) {
        EditorGUILayout.BeginHorizontal();

        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]);
        }
        EditorGUILayout.EndHorizontal();
    }
    --EditorGUI.indentLevel;
    ...
}

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?

5
PlayMaker Bug Reporting / Editor crash in 2018.3.2
« on: January 21, 2019, 11:25:27 AM »
We're experiencing a very frustrating bug – it happens routinely on one computer, but only very rarely on another. What's more, the editor log seems to report a variety of different causes/locations for the crash, though it always seems to be one of three stack traces. It mostly happens when entering or exiting Play mode, but sometimes on quitting the editor as well... so, perhaps when assets/prefabs are being read & written.

Selections of the three types are below:

Type I – Garbage collection
Code: [Select]
(these mono_traverse lines are repeated about a hundred times)
0x00007FFEFD0ABC0A (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:349] mono_traverse_array
0x00007FFEFD0ABFF7 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:304] mono_traverse_objects
0x00007FFEFD0ABC0A (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:349] mono_traverse_array
0x00007FFEFD0ABFF7 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:304] mono_traverse_objects
0x00007FFEFD0ABBC0 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:337] mono_traverse_array
0x00007FFEFD0ABFF7 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:304] mono_traverse_objects
0x00007FFEFD0ABBC0 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:337] mono_traverse_array
0x00007FFEFD0ABFF7 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:304] mono_traverse_objects
0x00007FFEFD0ABBC0 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:337] mono_traverse_array
0x00007FFEFD0AC6BA (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\unity-liveness.c:451] mono_unity_liveness_calculation_from_statics
0x00000001408F9639 (Unity) GarbageCollectSharedAssets
0x00000001409A785C (Unity) UnloadUnusedAssetsOperation::IntegrateMainThread
0x00000001409AAECF (Unity) PreloadManager::UpdatePreloadingSingleStep
0x00000001409AB7AA (Unity) PreloadManager::WaitForAllAsyncOperationsToComplete
0x0000000140E6AB6C (Unity) EditorSceneManager::RestoreSceneBackups
0x0000000141329E68 (Unity) PlayerLoopController::ExitPlayMode
0x0000000141335BDA (Unity) PlayerLoopController::SetIsPlaying
0x0000000141338AB2 (Unity) Application::TickTimer
0x0000000141494E2B (Unity) MainMessageLoop
0x0000000141496AC6 (Unity) WinMain
0x0000000142479C5A (Unity) __scrt_common_main_seh
0x00007FFF5B523034 (KERNEL32) BaseThreadInitThunk
0x00007FFF5D793691 (ntdll) RtlUserThreadStart

Type II – AnimationState destructor
Code: [Select]
========== OUTPUTTING STACK TRACE ==================

0x0000000141892449 (Unity) AnimationState::~AnimationState
0x000000014187FA22 (Unity) Animation::ReleaseAnimationStates
0x000000014187E8D2 (Unity) Animation::MainThreadCleanup
0x00000001405AC5A7 (Unity) delete_object_internal_step1
0x00000001408E0765 (Unity) CommitBatchDelete
0x00000001408F839C (Unity) DestroyObjectHighLevel_Internal
0x00000001408F8150 (Unity) DestroyObjectHighLevel
0x000000014097D534 (Unity) DestroyWorldObjects
0x0000000140E6A716 (Unity) EditorSceneManager::RestoreSceneBackups
0x0000000141329BAA (Unity) PlayerLoopController::EnterPlayMode
0x0000000141335BD3 (Unity) PlayerLoopController::SetIsPlaying
0x0000000141338AB2 (Unity) Application::TickTimer
0x0000000141494E2B (Unity) MainMessageLoop
0x0000000141496AC6 (Unity) WinMain
0x0000000142479C5A (Unity) __scrt_common_main_seh
0x00007FFF5B523034 (KERNEL32) BaseThreadInitThunk
0x00007FFF5D793691 (ntdll) RtlUserThreadStart

Type III – GetType
Code: [Select]
========== OUTPUTTING STACK TRACE ==================

0x00007FFEFCFF6751 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\icall.c:5598] ves_icall_System_Reflection_Assembly_GetTypes
0x00000000538B1586 (Mono JIT Code) (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
0x00000000538B133F (Mono JIT Code) System.Reflection.Assembly:GetTypes ()
0x000000003A646F22 (Mono JIT Code) [C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\ReflectionUtils.cs:91] HutongGames.PlayMaker.ReflectionUtils:GetGlobalType (string)
0x0000000000742663 (Mono JIT Code) [C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\ActionData.cs:661] HutongGames.PlayMaker.ActionData:GetActionType (string)
0x0000000000740A6B (Mono JIT Code) [C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\ActionData.cs:826] HutongGames.PlayMaker.ActionData:CreateAction (HutongGames.PlayMaker.ActionData/Context,int)
0x0000000000740283 (Mono JIT Code) [C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\ActionData.cs:776] HutongGames.PlayMaker.ActionData:LoadActions (HutongGames.PlayMaker.FsmState)
0x000000003A6EFE4B (Mono JIT Code) [C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\FsmState.cs:123] HutongGames.PlayMaker.FsmState:LoadActions ()
0x000000000073AFBB (Mono JIT Code) [C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:1750] HutongGames.PlayMaker.Fsm:InitData ()
0x000000005365D473 (Mono JIT Code) [C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\PlayMakerFSM.cs:891] PlayMakerFSM:OnAfterDeserialize ()
0x00000000535F3798 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007FFEFD0BBE4B (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\mini\mini-runtime.c:2809] mono_jit_runtime_invoke
0x00007FFEFD041E32 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\object.c:2919] do_runtime_invoke
0x00007FFEFD04AE3F (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\object.c:2966] mono_runtime_invoke
0x0000000140C007BA (Unity) scripting_method_invoke
0x0000000140BF0D8A (Unity) ScriptingInvocation::Invoke
0x0000000140C08C57 (Unity) InvokeMethod<RemapPPtrTransfer>
0x0000000140BB339F (Unity) TransferScriptingObject<RemapPPtrTransfer>
0x0000000140BB14A0 (Unity) SerializableManagedRefTransfer::Transfer<SerializableManagedRefBackupGenerator>
0x0000000140E26C59 (Unity) CopyProperties
0x0000000140E24C4E (Unity) CloneObjectsForPrefabSave
0x0000000140E24344 (Unity) CloneObjectsForPrefabSave
0x0000000140E2F05F (Unity) SavePrefab
0x0000000141F07D68 (Unity) AssetDatabaseV1::WriteSerializedAsset
0x0000000141F07F5C (Unity) AssetDatabaseV1::WriteSerializedAssets
0x0000000141EB732F (Unity) AssetDatabase::WriteRevertAssets
0x0000000140E6D245 (Unity) EditorSceneManager::ShouldSaveScenesAndAssets
0x0000000140E6C8A7 (Unity) EditorSceneManager::SaveScenes
0x0000000140E64E29 (Unity) EditorSceneManager::FileMenuSave
0x0000000140DDC381 (Unity) FileMenu::Execute
0x00000001412A8ABD (Unity) MenuController::ExecuteMenuItem
0x00000001412A85E5 (Unity) MenuController::ExecuteMainMenuItem
0x00000001422A196D (Unity) EditorApplication_CUSTOM_ExecuteMenuItem
0x000000003B14BD3E (Mono JIT Code) (wrapper managed-to-native) UnityEditor.EditorApplication:ExecuteMenuItem (string)
0x000000003B14BC0B (Mono JIT Code) [C:\buildslave\unity\build\Modules\ShortcutManagerEditor\ShortcutAttributeDiscoveryProvider.cs:140] UnityEditor.ShortcutManagement.MenuItemEntryDiscoveryInfo:<MenuItemEntryDiscoveryInfo>m__0 (UnityEditor.ShortcutManagement.ShortcutArguments)
0x000000003B1465D3 (Mono JIT Code) [C:\buildslave\unity\build\Modules\ShortcutManagerEditor\Trigger.cs:115] UnityEditor.ShortcutManagement.Trigger:HandleKeyEvent (UnityEngine.Event,UnityEditor.ShortcutManagement.IContextManager)
0x000000003B144853 (Mono JIT Code) [C:\buildslave\unity\build\Modules\ShortcutManagerEditor\ShortcutController.cs:95] UnityEditor.ShortcutManagement.ShortcutController:HandleKeyEvent (UnityEngine.Event)
0x000000003B144623 (Mono JIT Code) [C:\buildslave\unity\build\Modules\ShortcutManagerEditor\ShortcutController.cs:32] UnityEditor.ShortcutManagement.ShortcutIntegration:EventHandler ()
0x000000003B1443DD (Mono JIT Code) [C:\buildslave\unity\build\Editor\Mono\EditorApplication.cs:329] UnityEditor.EditorApplication:Internal_CallGlobalEventHandler ()
0x000000005353A855 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
0x00007FFEFD0BBE4B (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\mini\mini-runtime.c:2809] mono_jit_runtime_invoke
0x00007FFEFD041E32 (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\object.c:2919] do_runtime_invoke
0x00007FFEFD04AE3F (mono-2.0-bdwgc) [c:\buildslave\mono\build\mono\metadata\object.c:2966] mono_runtime_invoke
0x0000000140C007BA (Unity) scripting_method_invoke
0x0000000140BF0D8A (Unity) ScriptingInvocation::Invoke
0x0000000140BEADC5 (Unity) ScriptingInvocation::Invoke<void>
0x00000001401D28E1 (Unity) Scripting::UnityEditor::EditorApplicationProxy::Internal_CallGlobalEventHandler
0x0000000141288A66 (Unity) CallGlobalInputEvent
0x000000014147B955 (Unity) GUIView::ProcessEventMessages
0x00000001414749C9 (Unity) GUIView::GUIViewWndProc
0x00007FFF5CBB6D41 (USER32) CallWindowProcW
0x00007FFF5CBB6713 (USER32) DispatchMessageW
0x0000000141494FCF (Unity) MainMessageLoop
0x0000000141496AC6 (Unity) WinMain
0x0000000142479C5A (Unity) __scrt_common_main_seh
0x00007FFF5B523034 (KERNEL32) BaseThreadInitThunk
0x00007FFF5D793691 (ntdll) RtlUserThreadStart

Because of the irregularity of the error I haven't had much luck tracking down information on it; however, it does seem to occur specifically with PM installed. Talking to some folks at Unity, it seems like they have a bug ticket open with pretty much an identical stack trace. They are able to replicate the bug with the following code, which keeps data at the same address but potentially switching between types at run-time:

Code: [Select]
public class Foo {
    [StructLayout(LayoutKind.Explicit)]
    public struct Crasher {
        public Crasher(int indicator) {
            referenceType = null;
            valueType = 0;
        }

        [FieldOffset(0)] public int valType;
        [FieldOffset(0)] public GameObject refType;

        public static Crasher crash = new Crasher(0);
}

This is apparently done in the name of convenience, but results in the engine throwing an uncaught exception and crashing.

Bit of a long shot, but do any of the above stack traces look familiar, or like something folks have addressed in the past? Does the suggested val/ref type commingling look like something done in the PM internals, which could cause the crash?

Thanks for any insight.

6
PlayMaker Help / [SOLVED] Flag errors in CustomActionEditor
« on: September 25, 2018, 10:27:37 AM »
I've got a custom action, and it's being displayed with a CustomActionEditor.

The action has an FsmGameObject variable, which can either be null, or it can contain a GameObject. In my case, that object has to be a prefab, and it has to contain a specific component, so I can use CheckForComponent().

However, if the variable is empty/null, I get an "Error Editing Action" error. If I drag in any GameObject (whether a prefab, or anything from the scene), I get the CheckForComponent error. (Both errors shown here, apologies for image quality).

Since the variable is allowed to be null, I don't want the "Error Editing Action" error; since I specifically want the object (if it exists) to have a component and be a prefab, the CheckForComponent erroneously adds the ability to add the component to a given GameObject.

What I'd like to do is, in my CustomActionEditor, perform some validation on the variable (isPrefab, hasComponent), only if the variable is not null, and then flag an error from the action editor if there's a problem. However, I'm not sure how to flag these kinds of errors except with the variable attributes, which are giving me the above problems.

Is there a good way to flag config errors in a CustomActionEditor?

7
I'm trying to run a few checks on our FSMs from an editor window – this is just an editor tool, nothing that's going to execute at runtime.

The code is as follows (objectToFind is just the object we're looking at):
Code: [Select]
// get all the FSMs in this prefab
var allFsms = objectToFind.GetComponentsInChildren<PlayMakerFSM>();
if(0 < allFsms.Length) {
    foreach(var fsm in allFsms) {
        // get all the states in this fsm
        var states = fsm.FsmStates;
        foreach(var state in states) {
            // get all the actions in this state
            var actions = state.Actions;
            foreach(var action in actions) {
                // check stuff
            }
        }
    }
}

However, I keep getting the following error at the "var actions = state.Actions;" line:
Code: [Select]
get_actions: Fsm not initialized: State 1
UnityEngine.Debug:LogError(Object)
HutongGames.PlayMaker.FsmState:get_Actions() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:731)

...along with "get_fsm: Fsm not initialized: State 1" and "Error Loading Action: State 1" and others. I've tried this where objectToFind is a prefab selected from the Project window, and also an instance selected from the Hierarchy window; both have had the same effect.

8
I'm just logging some info so I can see what's going on within a build. One state has Build String and a Debug Log actions (the log is written to the Unity Log as well); then there's a Next Frame Event which jumps back into the same state. I expect this to just do the logging once per frame.

When I run the game in the editor, I don't see any logging. However, if I choose any FSM component, and hit the Edit button so that the PlayMaker editor window is opened, then the logging begins immediately, and continues even if I close the PM window.

The logging does not work at all in a build on device (iOS).

Is there a reason the logging doesn't happen until a PlayMaker window is opened in editor? Is there a way to get the logging to work in a build as well, so I can read it out from the Xcode console?

9
Hey folks, wasn't sure if this should be reported as a bug or a request, but it seemed more like unintended behaviour so I'm putting it here.

We've got an array of, say, five floats: 1, 2, 3, 4, 5. We were using ArrayGetNext to iterate through the list and print out the numbers in turn, but it always seems to print out the last item twice, as in:
1, 2, 3, 4, 5, 5, 1, 2, 3, 4, 5, 5, 1, 2, 3, 4, 5, 5, ...

We don't have a "finished" or "loop" event on the action, just letting the state finish naturally and loop back onto itself. On investigation in the ArrayGetNext script, the problem was at this line:
Code: [Select]
void DoGetNextItem()
{
// no more children?
// check first to avoid errors.

if (nextItemIndex >= array.Length)
{
nextItemIndex = 0;
currentIndex.Value = array.Length -1;
Fsm.Event(finishedEvent); // this "early out" is the problem
return;
}

// get next item

result.SetValue(array.Get(nextItemIndex));
...

Basically, if you reach the end of the array, this fires the finishedEvent and stops the action immediately, before changing the result value. So even though this action finishes and internally has reset to index 0, it doesn't update the exposed 'result' variable, which is why we have to run through it twice to start the array over.

I was able to fix this problem as follows:
Code: [Select]
void DoGetNextItem()
{
// no more children?
// check first to avoid errors.

if (nextItemIndex >= array.Length)
{
nextItemIndex = 0;
currentIndex.Value = array.Length -1;
if(null != finishedEvent)
{
Fsm.Event(finishedEvent);
return;
}
}

// get next item

result.SetValue(array.Get(nextItemIndex));
...

This way, if we don't have a finishedEvent, we'll update the result value as intended before finishing the action.

Again, I'm not sure if that's the intended behaviour, or if my hack is a safe fix – it worked in our case, but I don't know PlayMaker's idiosyncrasies well enough to know if this is wise. Anyway, thought I'd point it out.

10
PlayMaker Help / [SOLVED] When do Bool Test events fire?
« on: May 22, 2018, 01:53:12 PM »
We've got a state that has many steps to it, and they all happen every frame. One of them is a ScreenToWorldPoint, and it stops with an error if one of the inputs is NaN (which makes sense).

We've made a custom IsNan test, which then passes a bool to BoolTest; if the BoolTest returns true (because IsNan is true), then it should fire an event leaving the state, and, we hope, avoiding the ScreenToWorldPoint, which would crash.

However, it seems like we're still crashing with the same error, that the test point is outside the camera frustum. In this case, even if the BoolTest wants to send the event, does PlayMaker still process every action in that state first, before firing the event and making the transition? Or should the event fire immediately, skipping the ScreenToWorldPoint bug? If the latter, that would mean we probably have some other logic problem in our FSM.

Pages: [1]