Author Topic: UITexture failing to render on top when "maximized on play"  (Read 8640 times)

Freaking-Pingo

  • Guest
UITexture failing to render on top when "maximized on play"
« on: January 09, 2013, 07:37:41 AM »
Hi there, I am currently in the process of making a cooldown system, though I having some issues with the draw orders (I think).
I have a button, which uses a background from an Atlas using UISprite. When the button is clicked, a cooldown texture appears on top of this background using the UITexture (I can't atlas this texture, because I have to use different materials using Alpha cutoff).

All this is working fine, until I run the game in "Maximized on play". Then the UITexture won't draw at all, though I can see it in the editor, but not on the game window.


Top image being the editor window
Bottom image being the game window


I find this very confusing, and I hope you can help.


Here is the order (don't know if this have anything to do with it)


Skillbutton1 being the button
Background being the UISprite using an Atlas
Cooldown being the UITexture using a shader
« Last Edit: January 09, 2013, 08:01:00 AM by Freaking-Pingo »

dlewis

  • Guest
Re: UITexture failing to render on top when "maximized on play"
« Reply #1 on: January 09, 2013, 07:46:10 AM »
I assume you've tried playing with the z depth to bring the UITexture closer to the camera?

Freaking-Pingo

  • Guest
Re: UITexture failing to render on top when "maximized on play"
« Reply #2 on: January 09, 2013, 07:52:09 AM »
Yep, doesn't really do anything. The worst part is, I don't even think it is rendered when "Maximized on play". Even when placed in the middle of the screen (No GUI elements behind it) it isn't rendered.
I tried replacing the UITexture with a UISprite, just to see if it works, and it does.
« Last Edit: January 09, 2013, 07:53:47 AM by Freaking-Pingo »

Ferazel

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 150
    • View Profile
Re: UITexture failing to render on top when "maximized on play"
« Reply #3 on: January 09, 2013, 01:20:58 PM »
As long as the cutoff shader is using the correct render queue it should be resolvable using the ZDepth of the texture. Can you get some screens of each of the GameObject's transform values (maybe the whole inspector if you can swing it)?

It works fine as long as Maximize on play isn't clicked? Does it work ok in a deployed situation?

Freaking-Pingo

  • Guest
Re: UITexture failing to render on top when "maximized on play"
« Reply #4 on: January 09, 2013, 05:00:59 PM »
Here are my inspector values etc:
OBS: I know the Z-Value is 1 on both the Background and Cooldown, but trust me. I have configured that value several times, without any success.



Sadly, I can't make a proper build at the moment :/
« Last Edit: January 09, 2013, 07:43:10 PM by Freaking-Pingo »

Freaking-Pingo

  • Guest
Re: UITexture failing to render on top when "maximized on play"
« Reply #5 on: January 10, 2013, 11:20:22 AM »
I am still having this issue, and I don't know how to resolve it. :/

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITexture failing to render on top when "maximized on play"
« Reply #6 on: January 10, 2013, 12:42:56 PM »
Why are you using a UITexture here? That's just asking for trouble due to Z-issues. Use a sprite instead. In Windward I had a sprite using image XYZ (tinted dark), and on top a filled sprite using image XYZ (no tint).

Freaking-Pingo

  • Guest
Re: UITexture failing to render on top when "maximized on play"
« Reply #7 on: January 10, 2013, 04:53:21 PM »
The reason for using an UITexture is because I am trying to make this cooldown system. The UITexture is in reality a texture with an alpha channel, so when adjusting the alpha cutoff in the shader, the texture fades in/out like a analog clock/watch.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UITexture failing to render on top when "maximized on play"
« Reply #8 on: January 10, 2013, 05:41:33 PM »
I understand. Now just try what I suggested. :)

UISprite (spriteName = YourIcon). Set its color to be grey.

...on top of it (exactly on top of it!) -- a UIFilledSprite (spriteName = YourIcon). Leave its color as white.

Set the UIFilledSprite's "Fill Dir" to be Radial360, and play with the "Fill Amount" slider.

Freaking-Pingo

  • Guest
Re: UITexture failing to render on top when "maximized on play"
« Reply #9 on: January 10, 2013, 05:42:41 PM »
Okay thanks, I'll dive into it tommorow - Thank you for the great support :)

Freaking-Pingo

  • Guest
Re: UITexture failing to render on top when "maximized on play"
« Reply #10 on: January 12, 2013, 01:28:20 PM »
Wow this was so much easier to implement that expected. Damn. :) Thank you so much, works like a charm