playMaker

Author Topic: Gui Depth and the FSM order in the Inspector  (Read 7265 times)

Xtopher

  • 1.2 Beta
  • Junior Playmaker
  • *
  • Posts: 71
    • Well Played Games
Gui Depth and the FSM order in the Inspector
« on: October 26, 2011, 08:19:19 PM »
Ok, I've made an observation and I have to ask if I'm seeing random stuff, or if this really is the way things work.

First off, I'm trying to use GUI Depth to move things forward/backward in the GUI... and it seems to have no effect!  While fiddling with this I realized that if I have an FSM at the bottom of the list in the inspector it will draw in back of everything else!  This means that the GUI elements I use in the last (latest) FSM I have created will draw in back.  I've deleted, remade, etc a few times and this seems to hold true.  Am I really seeing something as it was intended to work, or is this a fluke?  If this is the case, is there a way to change the order of this stack without deleting/re-creating? 

And of course, if I figure out what's going on with GUI Depth and how it works, this might become a moot question, but so far it's the thing that's allowed me to get the right sort depth!

Thanks

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Gui Depth and the FSM order in the Inspector
« Reply #1 on: October 27, 2011, 07:27:58 AM »
That is interesting.. i tried at one point to use the depth but i did not have any luck.. but i changed how i was doing things and moved on. Figured it was just me.

Q

Xtopher

  • 1.2 Beta
  • Junior Playmaker
  • *
  • Posts: 71
    • Well Played Games
Re: Gui Depth and the FSM order in the Inspector
« Reply #2 on: October 27, 2011, 12:20:04 PM »
Yeah, I'm sure there is more going on behind the curtain than I am realizing, and I'm not too interested in putting in a lot of effort since the whole Unity UI is about to get a (MUCH NEEDED) reboot!  Usually I wouldn't need to use gui depth at all, but in this case it seemed a best option.

Xtopher

  • 1.2 Beta
  • Junior Playmaker
  • *
  • Posts: 71
    • Well Played Games
Re: Gui Depth and the FSM order in the Inspector
« Reply #3 on: October 27, 2011, 02:03:05 PM »
There seem to be some bugs on the GUI stuff, because I'm getting some flaky behavior.  Like as I add new gui buttons, old ones that used to work fine will start triggering the new button instead!  Or sometimes buttons just stop responding to clicks/taps at all.  I think I'm going to have to go back to straight script for the GUI menu items and have them call Playmaker FSMs for actions.

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Gui Depth and the FSM order in the Inspector
« Reply #4 on: October 27, 2011, 02:04:30 PM »
I am no help there as i use EZ GUI..

Good luck

Q

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Gui Depth and the FSM order in the Inspector
« Reply #5 on: October 27, 2011, 02:10:29 PM »
I'll take a look at this. All GUI actions are executed in one OnGui call by the PlayMakerGUI component in the scene, making it a lot quicker than the normal OnGui per GameObject that Unity would use. But this optimization might have introduced bugs or unexpected behavior...

Make sure you only have one PlayMakerGUI component in the scene. Multiple components could lead to weird behavior...

Xtopher

  • 1.2 Beta
  • Junior Playmaker
  • *
  • Posts: 71
    • Well Played Games
Re: Gui Depth and the FSM order in the Inspector
« Reply #6 on: October 27, 2011, 02:43:37 PM »
Yeah, I have only one playmaker gui component.  And I like it that you batched/optimized them!  There's something slippery going on though and I'm having a hell of a time nailing down exactly what it is.  Not sure I can without seeing under the hood, and maybe I'm just implementing something in a completely wrong way!  Some details, if it helps:

- I have one Playmaker gui component, and all the FSMs are on it
- I have seven FSMs, with either GUI buttons or a background texture in them.  But the behavior started to show up when I added my second FSM.  I can "fix" the behavior by deleting the offending FSM, and recreating it from scratch.  But then the behavior pops up somewhere else.
- I did copy/paste a couple FSMs, and it was right around then the bugs started.  Might be related
- All FSMs are fairly simple, 3 - 5 states, toggle buttons between on/off and set some global vars, etc
- The creation of a new FSM with a button is the thing that changes the behavior of previously created stuff.  This is trigger that makes the magic happen!
- I've tried using GUI Depth in various places.  It doesn't seem to give me any noticeable results, and this bug/behavior happens whether or not GUI Depth is present in any states
- I am using a GUI Skin.  I've tried applying it globally once and individually in several places, and it seems to make no difference in the behavior of the bug.

Hopefully something in there helps narrow it down!  :)   Thanks!

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Gui Depth and the FSM order in the Inspector
« Reply #7 on: October 27, 2011, 05:11:56 PM »
A small repro project would be ideal  :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Gui Depth and the FSM order in the Inspector
« Reply #8 on: October 31, 2011, 01:39:44 AM »
Hi,

I encounter the same problems actually. Never worked with gui and playmaker before, and I am building a drop down menu only with playmaker ( with arrayMaker). But I have also a lot of problems with depth. Will post the project when it's in a suitable shape.

It seems the depth has no effect and only the order of actions seems to determine the depth, also then how can depth be controlled from one fsm to another..

 Bye,

 Jean

tobbeo

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 186
Re: Gui Depth and the FSM order in the Inspector
« Reply #9 on: October 31, 2011, 03:35:09 AM »
I don't know if this will be helpful at all but why even use Unity's GUI system? It's all textures polys and text anyway. To make sure they are always rendered last (on top of everything else) I have a script attached to my own gameobject GUIs:

GetComponent<MeshRenderer>().material.renderQueue = GetComponent<MeshRenderer>().material.renderQueue =+90;

Also, in a 2D game like mine, this is a very handy line to control the render order of your "sprites" (planes with textures). And of course all my GUI objects have the camera as its parent.

I just personally never liked Unity's GUI system so I decided early on that I'd much rather do my own. Anyway I am sure you guys have your reasons, I just thought I'd add my 2 cents!