playMaker

Author Topic: Gui Overlapping!  (Read 651 times)

Amy

  • Newbie
  • *
  • Posts: 31
    • View Profile
    • Email
Gui Overlapping!
« on: May 01, 2012, 08:27:03 PM »
So I'm currently trying to build an inventory. I have a texture for an item and a texture for the actual inventory viewer graphic. The problem is I'm having trouble letting the card texture show ABOVE the inventory graphic. I'v tried adding "Gui Depth" but nothing seems to effect it. Any suggestions anyone? ><

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 1644
    • View Profile
    • LinkedIn
    • Email
Re: Gui Overlapping!
« Reply #1 on: May 02, 2012, 11:17:13 AM »
Are the textures drawn in different FSMs? Or the same FSM?

Amy

  • Newbie
  • *
  • Posts: 31
    • View Profile
    • Email
Re: Gui Overlapping!
« Reply #2 on: May 02, 2012, 01:21:28 PM »
They are different FSMs, one is a GUI button the other a GUI Box. Maybe I'm using them the wrong way?
« Last Edit: May 02, 2012, 02:00:48 PM by Amy »

kinetiknz

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
Re: Gui Overlapping!
« Reply #3 on: May 03, 2012, 06:43:59 PM »
Hey, this isn't a solution for your problem really, but I messed around with drawing GUI's with PM for a while, then I learnt ezGUI and find it immensely more useful in production. The GUI system is such a nightmare, I think the $200 is well worth it.

Amy

  • Newbie
  • *
  • Posts: 31
    • View Profile
    • Email
Re: Gui Overlapping!
« Reply #4 on: May 03, 2012, 07:46:59 PM »
Hey, this isn't a solution for your problem really, but I messed around with drawing GUI's with PM for a while, then I learnt ezGUI and find it immensely more useful in production. The GUI system is such a nightmare, I think the $200 is well worth it.

Was hard enough to buy playMaker for 95 xD I actually have decent Photoshop skills I just wish the gui depth worked as it should lol

Amy

  • Newbie
  • *
  • Posts: 31
    • View Profile
    • Email
Re: Gui Overlapping!
« Reply #5 on: May 04, 2012, 03:23:46 PM »
Anyone have any help? This should be pretty basic stuff.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 1644
    • View Profile
    • LinkedIn
    • Email
Re: Gui Overlapping!
« Reply #6 on: May 04, 2012, 05:28:13 PM »
So I did some digging on this...

It turns out GUI.depth only works when called from different scripts. It doesn't work when called from a single OnGUI.

Now it may look like GUI actions are called from different scripts, but under the hood PlayMakerGUI combines all GUI actions into a single OnGUI call. Most of the time this is a VERY good thing, resulting in huge performance gains, but in this case it's not so good since it breaks GUI.depth :(

This optimization was introduced in an update, so Set GUI Depth used to work, but now it doesn't do anything (as far as I can tell - Unity GUI seems to be a bit quirky).

I'll see if there's a way to fix GUI.depth, but in the meantime, you could:

- Draw the textures in the same state.
- Use GUITextures instead. These are easily layered with the Z coordinate.
- Or use some combination. E.g. GUITextures for the background and GUI actions for the foreground.


Amy

  • Newbie
  • *
  • Posts: 31
    • View Profile
    • Email
Re: Gui Overlapping!
« Reply #7 on: May 04, 2012, 07:04:39 PM »
So do you mean I have to make an in game object and texture it?  ???

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 1644
    • View Profile
    • LinkedIn
    • Email
Re: Gui Overlapping!
« Reply #8 on: May 04, 2012, 08:17:33 PM »
Unity has a built in system for this:
http://unity3d.com/support/documentation/Components/class-GuiTexture.html

It actually pre-dates the OnGUI system and is great for basic game UI stuff.

Playmaker GUITexture and GUIText actions are collected under the GUI Element category:
https://hutonggames.fogbugz.com/default.asp?W361

For example,  GUI Element Hit Test lets you send events when a GUITexture is clicked on.