Playmaker Forum
PlayMaker News => General Discussion => Topic started by: seldomU on April 12, 2016, 09:43:10 AM
-
Update:
The PlayMaker communication graph is now shipped as part of RelationsInspector, which is now free and open source (https://github.com/seldomU/relationsinspector).
- Asset store page (https://www.assetstore.unity3d.com/en/#!/content/53147)
- Documentation (https://seldomu.github.io/riBackends/PlayMakerFsmCommunicationBackend/)
Original post:
Hello,
I'm developing a graph visulazing tool for Unity and would like to add PlayMaker support to it. In particular, I want it to show how FSMs are connected through events. Currently it looks like this:
(https://raw.githubusercontent.com/seldomU/seldomu.github.io/master/assets/PlayMakerFsmLinks.gif)
The gif shows the PlayMaker window next to the graph window. All scene FSMs are shown as nodes, the events sent between them are shown as edges. When a node is selected, PlayMaker will select that FSM. Edge markers show their event name as tool tip and allow you to open the state that sends the event as well as the transition that receives the event via context menu.
As a PlayMaker novice, I'd be happy about any feedback and critique. I've tested only with the sample scenes and would like to see what the graph of a real project looks like.
If you want to install it, these are the steps:
- Install the RelationsInspector demo (https://www.assetstore.unity3d.com/en/#!/content/54884)
- Install the attached package. It's the PlayMaker add-on for RelationsInspector.
- Open Window -> RelationsInspector
- Select PlayMakerFsmEventBackend from the window's toolbar dropdown.
- Click the show active scene button in the toolbar. That will open the graph.
-
Looks very cool! I'm going to try it out...
-
:o That looks damn cool and handy!
Something I was missing, a simple way to see how all the FSMs work together!
EDIT: checked it out, really nice start, here is some feedback / questions:
- only "public" events will show up in RI
- does not show events send to "FSM component"
- does not show events send by "send event by name"
- some bugs (f.e. playmakerbackend disappear after switching backends)
- a auto update function would be nice (f.e. update RI every XX frames)
- do you think it would be possible to illustrate shared variables, too (f.e get fsm float, set fsm float)?
- do you plan to sale a RI playmaker version or is RI Pro the only option?
- what about "call method" and "send message"? is it possible to mix backends, it would be handy to see the fsm events and the messages to or from other scripts as well?
btw: RI is great, had a look at the other backends ;)
-
Thank you for the kind words :)
- Aren't public events the only ones sent between FSMs?
- I'll add support for FSM component targets and send event by name actions. Should I add any other actions?
- The list of backends is filtered. Only the ones that match the target objects of the current graph are shown. Press Clear and all backend types will show up.
- Auto-refreshing the graph every x frames seems like overkill. The Rebuild button let's you do it manually. Maybe I'll make it a toolbar option.
- A shared variable graph is possible. Would you want it merged into the event graph or separate?
- I have no plans for a special PlayMaker version. All PlayMaker support will be in the form of free add-ons.
- Graphs for called methods and sent messages are possible too. Mixing them is a bit tricky, but I can see how that would be useful.
-
Auto-refreshing the graph every x frames seems like overkill. The Rebuild button let's you do it manually. Maybe I'll make it a toolbar option.
You could used the EditorWindow OnHierarchyChange event to rebuild the graph... or make that an option. Maybe in EditorWindow OnFocus as well.
I could also expose a delegate in the Playmaker editor when the FSM has been edited, so you could hook into that.
-
I could also expose a delegate in the Playmaker editor when the FSM has been edited, so you could hook into that.
That would be great. In the meantime, I'll make it optionally rebuild on scene changes.
I have a problem with SendEventByName: its event name field dropdown contains variables instead of events. Am I doing something wrong? SendEvent actions work fine.
-
Send Event By Name is designed to work with strings. So the dropdown shows string variables. It gives you a little extra flexibility to change the event sent at runtime. It could use a little browse button to set the string value to valid event names, like we do with animation names., but never got round to it. Most of the time you should be using Send Event, so it never became high priority...
Does that make sense?
-
Hi,
Also, one useful feature would be study and represent where events are fire using the api. I am doing a lot of monobehaviours acting as proxies for firing "system" events. Like for the new UI system. In Many projects, this is playing a important role in the logic flow.
I don't have a solution unfortunatly, other than declaring an attribute to use ( Like I do in PlayMaker Utils), but that means compatibility issues if that attribute is not declared within PlayMaker.
Bye,
Jean
-
Attached is the new version that adds support for SendEventByName actions and FSM Component targets.
@Alex: yes that makes sense. Btw, I can't use the hierarchy-change event for rebuilding the graph. It doesn't fire when FSM actions are modified.
@jeanfabre: I don't understand. Are we talking PlayMaker events or Unity events? There already is an add-on for Unity UI events (http://forum.unity3d.com/threads/ui-event-inspector.387532/).
-
Thanks, "send event by name" (also non global ones) and "FSM component" work just fine now! :)
- A shared variable graph is possible. Would you want it merged into the event graph or separate?
- Graphs for called methods and sent messages are possible too. Mixing them is a bit tricky, but I can see how that would be useful.
Great! Visible fsm events, fsm variables and communication to or from scripts would give one a good and quick project overview! I think it would be handy to have those in one backend view, maybe different icons / colors for events, variables and messages (methods)?!
Is visual debugging (like in playmaker FSMs) planned for RI? To see what's going on in runtime would be very helpful!
-
Hi,
I am talking about PlayMaker events yes. I have created multiple systems that allow developers to catch Unity events and forward them as PlayMaker events, and that happens within regular Monobehaviours.
There's a video explaning the basics:
Again, I am not sure it's practical for you to start looking outside PlayMaker, but in this case (as for all the proxies for PlayMaker you find on the Ecosystem), I created a standardized way of declaring these. It's not 'official' however.
Bye,
Jean
-
Thanks, "send event by name" (also non global ones) and "FSM component" work just fine now! :)
Nice! :)
I added relations for variable access between FSMs to the event backend, as you suggested. The new version is attached. Here (https://seldomu.github.io/riBackends/PlayMakerFsmCommunicationBackend/) I wrote basic documentation.
(https://raw.githubusercontent.com/seldomU/seldomu.github.io/master/assets/BackendPages/PlayMakerCommunicationBackendExample.png)
Is visual debugging (like in playmaker FSMs) planned for RI? To see what's going on in runtime would be very helpful!
That's beyond the scope right now, but could be added in a future version, provided that PlayMaker's public API allows it.
@jeanfabre: That seems really useful. Right now I only want to cover PlayMaker's own features though.
-
Wow- the ability to see Playmaker events in the graph like that is really useful- I will be buying your asset-
I'm able to see the variables set if I use "Set Fsm Variable"- they don't show up if I use "Set Fsm Float" o"Set Fsm Game Object"- it would be awesome if variables using those set/get actions showed up as well- unless they already do and there's a trick to it?
Awesome asset anyway :)
-
Thank you for the purchase!
I had only considered the Get/Set Fsm Variable actions, I didn't know about the others. I'll add all the Get/Set Fsm ... actions shortly. Are there any others I should include?
-
HI
i have just imported the demo version and also the unity package posted here and now i am trying to see playmaker graph but i dont see any option to do that
-
HI
i have just imported the demo version and also the unity package posted here and now i am trying to see playmaker graph but i dont see any option to do that
Hi,
these steps should get you a graph for your active scene:
- in Unity's menu bar, select Window > RelationsInspector
- RelationsInspector's toolbar has a dropdown of available backends. Select PlayMakerInterFSMCommunicationBackend
- a second toolbar appears below. Click its Show active scene button
-
Thank you for the purchase!
I had only considered the Get/Set Fsm Variable actions, I didn't know about the others. I'll add all the Get/Set Fsm ... actions shortly. Are there any others I should include?
With event's and the get/set fsm actions covered- I can't think of any other Playmaker stuff that is otherwise difficult to debug- it would be a huge help with just those :)
-
unfortunately in the drop down i dont see playmaker
-
i have reimported the script now i get error
NullReferenceException: Object reference not set to an instance of an object
RelationsInspector.Backend.PlayMaker.PlayMakerInterFSMCommunicationBackend.<GetSceneTargets>m__30 (.PlayMakerFSM pmFSM) (at Assets/Editor/GraphBackends/PlayMaker/PlayMakerInterFSMCommunicationBackend.cs:191)
System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[PlayMakerFSM].MoveNext ()
System.Collections.Generic.List`1[PlayMakerFSM].AddEnumerable (IEnumerable`1 enumerable) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:128)
System.Collections.Generic.List`1[PlayMakerFSM]..ctor (IEnumerable`1 collection) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:65)
System.Linq.Enumerable.ToArray[
-
i am getting error when i set the type to playmaker fsm and select active scene i get the following error.
i am using 5.3
NullReferenceException: Object reference not set to an instance of an object
RelationsInspector.Backend.PlayMaker.PlayMakerInterFSMCommunicationBackend.<GetSceneTargets>m__30 (.PlayMakerFSM pmFSM) (at Assets/Editor/GraphBackends/PlayMaker/PlayMakerInterFSMCommunicationBackend.cs:191)
System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1D`1[PlayMakerFSM].MoveNext ()
System.Collections.Generic.List`1[PlayMakerFSM].AddEnumerable (IEnumerable`1 enumerable) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:128)
System.Collections.Generic.List`1[PlayMakerFSM]..ctor (IEnumerable`1 collection) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:65)
System.Linq.Enumerable.ToArray[
-
I'm using 5.3 as well. Attached is an update that fixes the NullReference exception, but I suspect that's only a symptom, not the actual error.
-
i have got new error when i open a huge scene with many fsms
NullReferenceException: Object reference not set to an instance of an object
RelationsInspector.Backend.PlayMaker.PlayMakerInterFSMCommunicationBackend+<GetEventReceivers>c__AnonStorey15.<>m__34 (.PlayMakerFSM pmFSM) (at Assets/Editor/GraphBackends/PlayMaker/PlayMakerInterFSMCommunicationBackend.cs:251)
System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator12`2[PlayMakerFSM,HutongGames.PlayMakerEditor.FsmInfo].MoveNext ()
RelationsInspector.Backend.PlayMaker.PlayMakerInterFSMCommunicationBackend+<GetRelations>c__Iterator3.MoveNext () (at Assets/Editor/GraphBackends/PlayMaker/PlayMakerInterFSMCommunicationBackend.cs:92)
System.Linq.Enumerable+<CreateSelectIterator>c__Iterator10`2[RelationsInspector.Relation`2[PlayMakerFSM,RelationsInspector.Backend.PlayMaker.FsmLink],RelationsInspector.Relation`2[PlayMakerFSM,RelationsInspector.Backend.PlayMaker.FsmLink]].MoveNext ()
RelationsInspector.GraphBuilder`2[PlayMakerFSM,RelationsInspector.Backend.PlayMaker.FsmLink].AddRelations (RelationsInspector.Graph`2 graph, IEnumerable`1 entities, RelationsInspector.GetRelations getRelations, RelationsInspector.RNG rng, Int32 maxNodeCount)
RelationsInspector.GraphBuilder`2[PlayMakerFSM,RelationsInspector.Backend.PlayMaker.FsmLink].Build (IEnumerable`1 seeds, RelationsInspector.GetRelations getRelations, RelationsInspector.RNG rng, Int32 maxNodeCount)
RelationsInspector.Workspace`2[PlayMakerFSM,RelationsInspector.Backend.PlayMaker.FsmLink].InitGraph ()
RelationsInspector.Workspace`2[PlayMakerFSM,RelationsInspector.Backend.PlayMaker.FsmLink]..ctor (System.Type backendType, System.Object[] targets, RelationsInspector.GetAPI getAPI, System.Action Repaint, System.Action`1 Exec)
System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:513)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:519)
System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:528)
System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Activator.cs:338)
System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Activator.cs:274)
RelationsInspector.RIInternal.CreateWorkspace ()
RelationsInspector.RIInternal.InitWorkspace ()
RelationsInspector.RIInternal.OnSelectBackend (System.Type backendType)
RelationsInspector.RIInternal+<>c__DisplayClass1e.<SetBackend>b__1d ()
RelationsInspector.RelationsInspectorWindow.Update ()
UnityEngine.Debug:LogException(Exception)
RelationsInspector.RelationsInspectorWindow:Update()
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
-
Ok, that's the same issue in another line. Are you getting that with the same scene? Fix attached.
-
editor was too show now with many fsms
-
In general the tool can handle more than 100 nodes just fine, but upwards of that it starts to slow down. With that many nodes the graph becomes unreadable anyway. I'll look into an option to hide FSMs that are not connected.
-
i have 526 nodes
-
Ok that's heavy :D
The attached version has an toolbar toggle to hide the unconnected nodes. Enable that before generating the graph. Of course it only helps if the majority of your nodes actually are unconnected. Otherwise I think only some kind of hierarchical graph would make your data accessible.
@mdotstrange: this version also adds support for all the Get/Set Fsm ... actions.
-
This looks like it's coming along nicely!
The next Playmaker update will include a callback for OnFsmChanged that you can hook into to update the graph...
-
WOW - super useful!!!
-
@dudebxl: Thank you!
@Alex: Great, I'll build an auto-update option out of that.
-
RelationsInspector update 1.1.2 has arrived on the AssetStore today, with the PlayMaker communication graph as part of its package. To celebrate the launch, the full version is 50% off for a short time. Get it here:
- Full version (https://www.assetstore.unity3d.com/en/#!/content/53147)
- Demo version (https://www.assetstore.unity3d.com/en/#!/content/54884)
Documentation (https://seldomu.github.io/riBackends/PlayMakerFsmCommunicationBackend/)
Thank you guys for the feedback and suggestions!
-
I have a few vouchers for the RelationsInspector full version to give away. If you want one, just let me know.
-
I have a few vouchers for the RelationsInspector full version to give away. If you want one, just let me know.
Yes please! This looks great 8)
-
I have a few vouchers for the RelationsInspector full version to give away. If you want one, just let me know.
Hey that would be a great sauce for my tangled and dry FSM spaghetti :D
And i would be very grateful!
-
I have a few vouchers for the RelationsInspector full version to give away. If you want one, just let me know.
That would be nice!
-
You all got PMs :)
-
Hi,
Thx for the voucher.
As soon i have some time I will play around with it and review it (won't be this year anymore tho....to much work to do and family.)
-
Hey seldomU, thank you for the Christmas gift!
-
You're welcome :)
I'm out of vouchers now. For anyone else that's interested in RelationsInspector, there is still the free feature-complete demo here:
https://www.assetstore.unity3d.com/en/#!/content/54884
-
Thanks for the voucher SeldomU.
Looking forward to sitting down and checking this out in my next quiet time :]
-
I've tested RI and found something not so cool.
1> The FSM Name is not displayed, so if ONE Gameobject got More than 1 FSM things will get confused.
2> If I set the Target GameObject Variable by a Result Variable from actions like Get Owner, Get Root, Find Gameobject, Get Event Info(Sender)... It only works during Runtime cause the target variable's value is None in Edit Mode. Also if the variable is None during Runtime it keep's hidden.
3> FSM using an FSM Template only works during Runtime.
So it is hard to display all the event and set/get-variable relationship of FSMs by RI.
-
RelationsInspector is open source now, since I haven't had time to work on it anymore. If anyone is interested in improving the Playmaker integration, you are more than welcome!
The sources are here: https://github.com/seldomU/relationsinspector
You could even integrate it directly into Playmaker, if you wanted.