Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

PlayMaker - Visual Scripting for Unity

Discussion in 'Assets and Asset Store' started by Alex-Chouls, Dec 31, 2010.

  1. aabattery

    aabattery

    Joined:
    Sep 3, 2010
    Posts:
    48
    This is cool, but I have to ask, is there a way to remove the state names on the GameObjects when you build the game? It's cool for testing out the game, but on the actual build it's annoying. Will that only be for the finished version?
     
  2. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    You can turn the state labels off and on in the debug menu. Just turn them off before you make a build...
     
  3. teamwhitesnow

    teamwhitesnow

    Joined:
    Nov 12, 2010
    Posts:
    85
    Im really excited about trying this program but every time i download it ..it only has a read me in the zip file. am i doing something wrong??
     
  4. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    There should be a Playmaker folder inside the zip, next the readme...
     
  5. teamwhitesnow

    teamwhitesnow

    Joined:
    Nov 12, 2010
    Posts:
    85
    This is program is nothing less than amazing! I've been struggling for along time with coding basic things such as opening a door and now i can within a few minutes! I read most of the post from other unity users and my recommendation is after you sell playmaker dont stop there.you could sell upgraded versions of it that have more libraries and features. I believe in due time once alot of people are exposed to it, you'll see how vital this program can be for alot of hobbist who struggle with code.
     
  6. artboy

    artboy

    Joined:
    May 31, 2009
    Posts:
    22
    I think it's a real revolution and will allow some amazing new Unity development.
     
  7. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    Thanks guys!! I'm really excited to see what people make with Playmaker and Unity!

    Beta 7 is now available: download

    Release notes: here

    Highlights: A few small bug fixes, and new actions to control lights and render settings...

    Getting started videos: here

    My focus for the next update is more sample scenes...
     
  8. Feyhu

    Feyhu

    Joined:
    Sep 14, 2010
    Posts:
    211
    how do you get the input to do something? I have the input event but it doesnt do it.
     
  9. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    Not sure I know what you mean by "input event"? Maybe you're used to Virtools style building blocks...? Playmaker works a little differently. Playmaker uses event driven state machines. The active state runs Actions that you can combine and tweak. Events cause state changes and can come from Unity (collisions, triggers, mouse events etc.), actions that send events (e.g., MousePickEvent), or from your own scripts.

    Check out the overview video here: http://www.screencast.com/users/HutongGames/folders/PlayMaker
     
  10. Feyhu

    Feyhu

    Joined:
    Sep 14, 2010
    Posts:
    211
    and how do you make an event for button inputs?
     
  11. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    For keyboard/controller buttons, take a look at Input Actions

    For GUI buttons, take a look at GUI Actions or GUI Element Actions.

    GUI actions are not complete yet because I'm not that happy just mirroring GUI commands one to one, you just end up with a big list that's not much better than code... considering making some kind of custom GUI editor for GUI actions... but that won't be till after the 1.0 release.
     
  12. elvis75k

    elvis75k

    Joined:
    Feb 5, 2011
    Posts:
    24
    awesome tool, and great support. Now i can put Quest3d away finally ;)
     
  13. teamwhitesnow

    teamwhitesnow

    Joined:
    Nov 12, 2010
    Posts:
    85
    very nice .. i've just started playing with the gui..quick question .currently when i select things in my game i have to select it with the mouse (in first person view) is it possible to turn the mouse into a cursor and make it where the cursor always stays in the center of the screen so when you move your mouse to look around you dont have to have your mouse way out of the playing area(unity window)? my real goal is to make a interface where the objects you can interact with (a switch,button, weapon) are in range of a player the closest object will be highlighted or outlined then a gui box will display a image of it (example : borderlands loot system
     
  14. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    You can use the MouseCursor action. It lets you set a custom texture, hide the regular cursor, and lock to the center of the screen. Generally you'll want an FSM just controlling the cursor mode. Then you can just send it events to change the cursor (e.g. when you roll over a target).

    Check out the ButtonDoor sample for an example. In the Unity editor you have to click in the game view to center the cursor, and press escape to unlock it. In a real build you'd need to handle unlocking the cursor yourself (e.g., press escape to switch the cursor state to an unlocked mode).

    MousePickEvent lets you set a picking distance and send events. However it goes on the object being picked, which may not be what you need in this case... I've been meaning to add a MousePick action that returns the object picked - will get that into the next update.
     
  15. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    @elvis75k - Thanks! Playmaker will definitely grow over time, so let me know if there are actions that you'd like to see (I'm not that familiar with Quest3d).
     
  16. teamwhitesnow

    teamwhitesnow

    Joined:
    Nov 12, 2010
    Posts:
    85
    Great! (by now if you haven't noticed i'll be posting alot of my research/reports from using playmaker .daily/weekly) im going to spend a day or so working on what you just told me then let you know how it turned out. in the mean time when you send the updates are we supposed to delete the last version off of unity and reimport the new package or does it just update?
     
  17. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    Fantastic! The more feedback the better!

    There's also a bug/feature request forum here: https://hutonggames.fogbugz.com/default.asp?playmaker

    That forum is convenient for me because I can turn posts into Fogbugz work items with a single click, and it links to the thread etc.

    You'll have to import the new package when there's an update - there's no auto update feature...
     
  18. teamwhitesnow

    teamwhitesnow

    Joined:
    Nov 12, 2010
    Posts:
    85
    alright i'll be sure to do that .. your interaction with everyone on the forum is amazing! asking for suggestions and letting us know our voices will be heard is a great way to attract more people :)
     
  19. hajasal_sk

    hajasal_sk

    Joined:
    Jan 5, 2010
    Posts:
    37
    This is a tremendous tool. Do you have any concrete thoughts on pricing yet?

    Also, when the FSM window is docked, I'm noticing that sometimes it won't populate the list of objects until I close and reload the window. Is this a known issue? When undocked everything works properly.
     
  20. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    We plan to submit to the asset store this week and it will cost $100.

    I'm not sure why the behaviour of the editor windows sometimes changes when docked - it may be a quirk in Unity, but I'll look into it...

    I'm posting an update tomorrow that I'm pretty excited about. Lots of little workflow improvements, bug fixes, and new actions.

    I whipped up this test in 10 minutes to play with some physics: here.

    And a quick test with the new MousePick and GUILayout actions: here

    Here's an older sample published for the web: NoExit.

    A key goal for Playmaker is clarity and simplicity while letting you tap the full power of Unity!
     
  21. elvis75k

    elvis75k

    Joined:
    Feb 5, 2011
    Posts:
    24
    Can't wait to play with the new sample scenes.. just a question: by using playmaker instead of coding myself, there are possibilities of framerate drop or performance loss in any terms? Hope you understand what i'm saying.
     
  22. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    RC1 is now available: download

    Release notes: here

    Highlights: Action foldouts, move up/down buttons, GUILayout actions, integrated Vector3 variables into more actions, more samples...

    Getting started videos: here

    Playmaker Beta used in winning entry at Global Game Jam Sydney: http://www.globalgamejam.org/2011/press-3-breed

    I whipped up this test in 10 minutes to play with some physics: here.

    And a quick test with the new MousePick and GUILayout actions: here

    Here's an older sample published for the web: NoExit.

    Unless there are show stopping bugs in this release, the next release will be in the asset store...
     
  23. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Awesome Alex,
    Btw, can you point me out what data types are used internally by PlayMaker actions?
    Cheers,
     
  24. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    @elvis75k - "framerate drop or performance loss in any terms" is pretty all encompassing! There is some overhead with an event driven state machine - just as there would be with any organizing framework that you might code yourself. The biggest impact is probably when loading/initializing the state machines, but still not bad - after that, performance impact should be minimal. There's also an overhead with the Playmaker editor, so make sure to test the performance in deployed builds too...

    In fact, behind the scenes, Playmaker helps you avoid common performance pitfalls. For example, MousePick and MousePickEvent actions use a cached ray picking system to minimize raycasts that can get expensive. Calls to get object components are also cached. And I'm working on an ObjectPool system/actions that will make it easy to spawn objects from a pool instead of creating them during gameplay. These are the kinds of performance optimizations that developers would normally have to spend time figuring out/implementing... but they are built into Playmaker.

    You also have to weigh performance together with all the factors that go into making a successful game. If performance were the only criteria we'd all be writing our own engines in C++!
     
  25. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    @tatoforever - I really need to spend some time with the API docs...

    The action editor will recognize most common unity data types and present an appropriate gui (any subclass of unity object, int, float, bool, enum, string, color, vector3 etc.) One exception I can think of off-hand is LayerMask which isn't supported yet. You'll get an error in the action editor if the type isn't supported, and you can submit a feature request to add support for it...

    You can also add attributes to help the action editor present the best possible GUI for the data type.

    There are also FsmVariables that have a special gui in the action editor that let you enter a value or point to a named variable. E.g., FsmFloat, FsmInt, FsmString...

    FsmVariables really need some docs, but here are some pointers:

    • Get/set the wrapped value of an FsmVariable with the Value property (e.g., fsmFloat.Value).
    • The Name property is used to point to a named variable stored in the FSM (added using the Variable Manager).
    • When you get/set a named variable you are accessing the variable stored in the FSM.
    • Otherwise the variable is a unique instance.
    • Either way, you can just use the Value property and not worry about where it's coming from!
    • Fsm variables are guaranteed not to be null at runtime.
    • Check the IsNone property to check if the variable was set to none in the editor.

    I also posted an example of how to access FsmVariables from your own scripts earlier in this thread...

    I'll try to get a first draft of the API docs this week. But feel free to fire off questions since it will help me cover everything in the docs...
     
  26. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    4,364
    Awesome,
    Looking forward to get my hands on custom Actions creation! :)
     
  27. elvis75k

    elvis75k

    Joined:
    Feb 5, 2011
    Posts:
    24
    I want to go from targetA to targetB in a predefined time.
    I've found a platform Mover script from the 2d Game Platform tutorial that work (loop):

    Code (csharp):
    1. var targetA : GameObject;
    2. var targetB : GameObject;
    3. var speed : float = 0.1;
    4. function FixedUpdate () {
    5.     var weight = Mathf.Cos(Time.time * speed * 2 * Mathf.PI) * 0.5 + 0.5;
    6.     transform.position = targetA.transform.position * weight
    7.                         + targetB.transform.position * (1-weight);
    8. }
    If i call this with fsm script control the following error appear:

    I can see the script added in the hierarchy but without the targets.. How can i add the targets on the fly?
    Do i need a prefab of both targets and modify the script to add targets on demand?

    i guess i can do fix the above code to make targets available forever and ever.. or the better
    from the Transform action browser i can have set poistion of a game object with float animation, but at the moment
    this looks tricky..

    If i can solve this maybe i can have more fun with playmaker :)

    instead of using add script, i've used Enable Behaviour and it just work.
     
    Last edited: Feb 8, 2011
  28. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    Yeah, if you have a behaviour all set up on an object use Enable Behaviour to turn it off and on. Use Add Script if the script knows how to initialize itself. I'll add these notes to the docs...
     
    Last edited: Feb 8, 2011
  29. dogzerx2

    dogzerx2

    Joined:
    Dec 27, 2009
    Posts:
    3,964
    i'm testing it, seems to work well so far!

    i know it's beta, but I noticed you can't delete actions once you add them, you can only disable them. Same for adding FSM for objects, you can only add, but once its added you can't take them out!

    also, is there way to modify a float variable? or are they constant when you create it? I can't find a way to access it, I want a float variable to change according to mouse speed..
     
    Last edited: Feb 8, 2011
  30. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    You can remove an action from its settings menu (the cog). This is designed to work the same as components in the unity inspector...
    You can remove an FSM in the object's inspector panel from its settings menu (like any other component). I might expose this somewhere else though, for convenience...

    You can modify float variables using Math Actions. Other actions also store results in float variables (e.g., Get Distance).

    I don't have an action to get the mouse speed yet! Will be in next update... you could use GetMouseX/Y and do the math every frame...

    EDIT: Actually you can use GetAxis with "Mouse X" and "Mouse Y" to get mouse speed.
     
    Last edited: Feb 8, 2011
  31. artician

    artician

    Joined:
    Nov 27, 2009
    Posts:
    345
    You have created a beautiful thing. Thank you!
     
  32. vegeta

    vegeta

    Joined:
    Jan 12, 2011
    Posts:
    6
    it would be really nice if you could make some more tutorials.
    just how to create a guitext and interact with an integer.

    btw:
    there is a bug.
    if i go on a prefab(maybe a cube for now)so i cant add a fsm to it.
     
    Last edited: Feb 9, 2011
  33. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    411
    i finally got the chance to test it and for an artist (coming from flash and menu/interactive design) like me... its a dream come true! Great so far... i'll be purchasing it the moment you're ready to sell!

    btw: there is a small pause when initializing the project... will this delay increase with the complexity of the interactions/number of state machines?

    thanks!
     
    Last edited: Feb 9, 2011
  34. elvis75k

    elvis75k

    Joined:
    Feb 5, 2011
    Posts:
    24
    As far as i can see there's no support for movie textures or www.movie at the moment.
    Must use a script as a workaround.

    I have this script to get a switch driven by a key press that change from play to pause.
    I'm searching for an easy method to do this in playmaker but no luck.
    Is there a way to drive the switch (element of the script) using playmaker?

    Code (csharp):
    1.  
    2. var movTexture : MovieTexture;
    3. var otherClip: AudioClip;
    4.  
    5. var filmSwitch : boolean = true;
    6.  
    7. function Update () {
    8. movieController();
    9. }
    10.  
    11. function movieController(){
    12.     if (Input.GetKeyDown(KeyCode.Alpha1)) {
    13.         if (!filmSwitch){
    14.                 renderer.material.mainTexture = movTexture;
    15.                 movTexture.Play();
    16.                 audio.clip = otherClip;
    17.                 audio.Play();
    18.  
    19.                 filmSwitch = true;
    20.             }
    21.         else if (filmSwitch){
    22.                 renderer.material.mainTexture = movTexture;
    23.                 movTexture.Pause();
    24.                 audio.clip = otherClip;
    25.                 audio.Pause();
    26.  
    27.                 filmSwitch = false;
    28.             }
    29.     }
    30. }
     
  35. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    @artician - thanks!

    @vegeta - I plan to make more tutorials and sample scenes soon. I'm able to add an fsm to a prefab ok... are there other repro steps?

    @clandestine - Are you using RC1? Now that the bigger bugs are fixed I need to do some stress tests with the profiler. I'm sure there's stuff that can be optimized. The load time for FSMs is definitely top of my list. I also do some stuff in the editor because the data can change (e.g., checking if actions scripts have changed and trying to keep old data) that can be stripped out of a "release" build that can assume the data isn't going to change...

    @elvis75k - I haven't spent a lot of time with MovieTexture... I'll try to implement your example, and add any actions needed. Sounds like a good tutorial/sample scene... thanks!
     
  36. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    Finishing up support for interleaved arrays in actions. Basically lets you do things like this:

    $InterleavedArrays.png

    I'm excited about the switch actions. They're very legible and should make it easier to author complex branching...

    I'll be having a lot of fun with this feature, e.g., an animation blend action with a list of animations and weights for each layer, or an audio source mixer...

    Since this is new, and needs testing (along with a couple of other changes), I'll probably release another beta update.
     
  37. dogzerx2

    dogzerx2

    Joined:
    Dec 27, 2009
    Posts:
    3,964
    this project looks very promising! hope it keeps improving!
     
  38. rhianu

    rhianu

    Joined:
    Feb 25, 2010
    Posts:
    93
    Looks interesting.
     
  39. Sparty

    Sparty

    Joined:
    Aug 26, 2010
    Posts:
    83
    Loving this. Can't wait for a final release.

    -eric
     
  40. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    @elvis75k - read your post again and realized you were asking about ways to control the script from playmaker...

    Check out the ScriptControl actions: here.

    You could use SendMessage to set filmSwitch. I'll try to whip up an example for the next update...
     
  41. elvis75k

    elvis75k

    Joined:
    Feb 5, 2011
    Posts:
    24
    ok thank you!

    UseOwner <-- Game Object
    SendMessage <-- Delivery
    require receiver <-- Options
    movieController <-- Method Name
    string <-- Parameter
    filmSwitch <-- String

    nothing happend, what's wrong?
    See attach..(fiml was film sorry) - anyone can help me?
     

    Attached Files:

    Last edited: Feb 11, 2011
  42. elvis75k

    elvis75k

    Joined:
    Feb 5, 2011
    Posts:
    24
    ..now i've understood sendMessage better. I might change the movieController function to accept inputString instead of a keypress?!
     
  43. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    One way to do it is to add Pause and Unpause methods to FilmController, and call those with SendMessage. Or a Pause method with an int parmameter (1 = pause, 0 = unpause).
     
  44. elvis75k

    elvis75k

    Joined:
    Feb 5, 2011
    Posts:
    24
    The problem for me is scripting the code for it. I can only imagine that it will be a script with a very few lines for this FilmController available in the monobehaviour. I'm with PlayMaker to avoid scripting and at the same time i'm learning a bit of code :)
    Sorry if this is a little off topic.
     
  45. blind4

    blind4

    Joined:
    Jan 21, 2011
    Posts:
    15
    going try it
     
  46. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    Next update has MovieTexture actions and a simple sample scene:

    $MovieTexture.PNG

    You just use SetMaterialTexture, PlayMovieTexture and PauseMovieTexture actions...

    I'm doing another beta release since Unity 3.2 came out and want to check everything still works okay.

    Hopefully upload it in a couple of hours...
     
  47. ROCFriesePoort

    ROCFriesePoort

    Joined:
    Mar 27, 2009
    Posts:
    107
    What does the Vector in the Translate Action Do? I'm trying to translate an object relative to the camera. To get this, do I need the Vector option in the Translate Action?

    Thanks!
     
  48. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,652
    Translate currently works in Local or World space. You can supply a vector, or specify individual axis. You can also supply a vector and then override individual axis...

    Translating relative to camera requires another operation, I'll try to get that into the next update... I'm missing a few Transform and Vector actions still.
     
  49. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Any info on official release expected date and price line?
     
  50. ROCFriesePoort

    ROCFriesePoort

    Joined:
    Mar 27, 2009
    Posts:
    107
    @alexchouls: Thanks! In the mean time could you give an example on how to move an object away from the camera relative z-axis?