playMaker

Author Topic: How to reset a game object to its original status?  (Read 14172 times)

sein

  • Playmaker Newbie
  • *
  • Posts: 3
How to reset a game object to its original status?
« on: May 11, 2012, 01:36:45 AM »
Hi,

First time here. I'm working with a small team to make a game using unity3d. We've just acquired Playmaker and it's been fun playing with it. I've been assigned to make a UI with it but I don't have any knowledge of whatsoever in programing. So I don't really know the functionality of each Action State and their actual use. But I manged to make UI using playmaker never the less. Windows drops, texture changes, button interaction etc... all of these stuff that makes a UI.

Now for the problem that I'm having with my UI. I'm using my UI as a result screen. So when the players die or finish the stage the Screen will show up. In this result screen I have a Restart button to restart the game obviously but when the player dies and the screen changes to the Result Screen again, all the windows and textures on the button will be in the same position/Status from last time and will move further than planned. They wont reset to their original position and states.

Can you please help me with a method to restart the result window to its original status when it's not active?     

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to reset a game object to its original status?
« Reply #1 on: May 11, 2012, 03:13:05 AM »
Hi and welcome!

several options:

-- either you create a scene with the gui only and when reloading the level or loading the next level you additivly add the gui scene and all will be properly in place. but this might be too late to design it as such in your project.

-- the other option less dramatic, woudl be to simply delete the gameObjects responsible for this gui and reinstantiate it when starting the level, make a prefab out of it and simply delete it and recreate it at will, this is a very efficient method to make sure it starts fresh. If you have persistent data between levels, you can store them in persistent gameObject and when the gui Fsm starts, simply access this data as a first step then show the ui,  or save it in the PlayerPrefs for example.

-- the last option would be to maintain the original status definition in variables, and when starting a new level have the gui resetting it self to tgem values, ( for example the positions, the texts, the textures, etc etc) that's by far the most demanding technic because you need to build the mechanism to reset each portion of the gui that changed.

 hope this helps,

 Jean

sein

  • Playmaker Newbie
  • *
  • Posts: 3
Re: How to reset a game object to its original status?
« Reply #2 on: May 11, 2012, 04:38:32 AM »
Thanx Jean for the fast replay. It was helpful.

Actually the second option have been suggested by our programmer. But since we bought Playmaker and we are lacking in programers power we wanted to see how effective and helpful it is in our workflow.

I think it's a great plug-in to allow artists and designers to create something in unity but somehow I always feel that I'm lost with all of these actions and what are their use (although it's written yet it's still vague). Maybe if there was some type of sample for each of these actions along with verifiables it would be easy on us (feather brain artists) to find what we want :)

   

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How to reset a game object to its original status?
« Reply #3 on: May 11, 2012, 06:19:15 AM »
Hi,

 Example for each actions would be good of course, tho I think it would only go so far as the particular use in that possible example, an action in itself is not much doing anything in terms of feature in your game, it's the usage and context that make sense in the end, so it is indeed difficult if you don't have a clear understand of what Fsm can do for you to find the right action to use.

 It's like asking Unity to provide an example of each api functions... it's not really helping finding the right function, because you woul dend up with 1000's of example and going through them would not be very effective.

 I suggest you go over all the samples provided by playmaker, and also watch the videos and screencasts, this way you can pick up design patterns and then really nail what action you need specifically, find out if it's thre or not, and don't hesitate to ask us on this forum, Most of time, after two or three searches you will start to be a lot more autonomous with finding the right action.

now: The second options ( all of them actually) is really completely doable in Fsm, you can destroy gameObjects with playmaker, search "destroy" in the actions browser search field ( search in the action browser window this is the best way currently to find out what's available for a given purpose).


The biggest hurdle in a worfklow where scripts and Fsm are working together is to find the right balance between what should be done in playmaker and what should be scripted. On top of that, both system will want to communicate:  I am always using a combination of Fsm and scripts instead of trying to make everything in playmaker and create custom actions just for that projects, I prefer having my scripts using the playmaker api to access fsm, sent events, or ser variable from scripts rather than writing a custom action that tight to one of my script. I don't think this is a good idea in many cases, unless that script is a "framework". Custom Actions "need" to be reusable in any projects, this is of course just my opinion, and it's perfectly acceptable ( and faster many times) to write a custom action to bind playmaker and scripts together.


so try to delete and create prefabs with playmaker, if you have trouble, don't hesitate to ask here, I'll be happy to provide working example if that helps you moving forward.

 Bye,

 Jean