Hello Guest

Author Topic: FSM: One scene for each state?  (Read 3860 times)

Biktor

  • Newbie
  • *
  • Posts: 11
    • View Profile
FSM: One scene for each state?
« on: July 28, 2014, 06:37:01 pm »
I'm a noob with Unity + 2DToolkit who came from Air / Starling.
I want to implement a FSM and after had read many tutorials, I have a doubt.

My game target is iOS / Android and some tutorials does one scene for each state, but Is this good strategy for mobile development?
Maybe I'm wrong but I'm thinking that is bad for performance.

Is it a good approach one scene for each state?
Are there some alternative more efficient?

Thank you.
« Last Edit: July 29, 2014, 09:47:10 am by Biktor »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: FSM: One scene for each state?
« Reply #1 on: July 30, 2014, 12:33:49 pm »
I think this question is better on a Unity forum / Unity answers.
One scene for each state is fine, but really depends on your game. If the scenes are independent that fine.

Biktor

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: FSM: One scene for each state?
« Reply #2 on: July 30, 2014, 05:20:26 pm »
Thank you, here the answer on Unity forum:

Steve Tack
Quote
The term "state" is very general, so it might help if you were more specific. It sounds like you're talking about using states for different "screens"? Like menu screens?

You could try it and see how it goes. Sometimes optimizing when you don't really need to is a waste of time. But if you do run into performance issues, you can draw "screens" by making your UI elements active or inactive. So if you had an Options state, maybe you'd activate a parent GameObject that contained all of your Options UI and inactive everything else.

Often an FSM has a place to put "I'm entering this state" code. So you could do that there for each UI state.

I ended up writing my own screen manager that works with NGUI to make that sort of thing easier, which could be overkill depending on how complex your UI is.

The only mobile game I've done only uses a single scene. There's an FSM to manage what to do when.

Thank for the reply.