playMaker

Author Topic: [SOLVED] draw a GUI texture over another  (Read 8370 times)

santelia

  • Junior Playmaker
  • **
  • Posts: 78
[SOLVED] draw a GUI texture over another
« on: April 09, 2012, 12:47:19 PM »
Let's say I have a GUI texture with the background texture for all the user informations (you know: health, goals reached, points, energy, etc). That texture is put in a corner of the screen using the "draw texture" action with appropriate values, after an "enable GUI" action. What can I do if I want to draw something over it, as a layer (health bar, statistics, points, etc). How can I overlap more than one texture? The draw bar is a flat texture stretched to fit a given dimension. The other informations will be number, text, little icons. Any help?
« Last Edit: April 15, 2012, 07:19:00 PM by Alex Chouls »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: draw a GUI texture over another
« Reply #1 on: April 11, 2012, 03:28:42 PM »
If the Draw Texture actions are in the same FSM, they get executed in order. If they're on different FSMs, controlling their draw order is a little trickier. You could try playing with Set GUI Depth.

Otherwise you might consider using GUITexture GameObjects instead, since you can set their draw order in the Unity inspector using the Z position on the Transform component (negative moves forward, positive moves backwards).

santelia

  • Junior Playmaker
  • **
  • Posts: 78
Re: draw a GUI texture over another
« Reply #2 on: April 12, 2012, 03:27:09 AM »
Z position... interesting trick. Thx

santelia

  • Junior Playmaker
  • **
  • Posts: 78
Re: draw a GUI texture over another
« Reply #3 on: April 12, 2012, 05:52:31 AM »
When you set a Gui Depth for an element (texture, text, etc), will it be assigned through the entire scene as a global variable, or it's limited to a single FSM?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: draw a GUI texture over another
« Reply #4 on: April 14, 2012, 05:35:03 PM »
All PlayMaker GUI actions are called in a single OnGUI call in PlayMakerGUI. So it should be global. But again, the order of GUI actions on different FSMs is hard to control...

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: draw a GUI texture over another
« Reply #5 on: April 15, 2012, 07:18:33 PM »
I'm guessing this is a duplicate of this question:
http://hutonggames.com/playmakerforum/index.php?topic=1362.0

We've talked through a few different ways to do this, so I'll mark it solved...