Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Darkness on October 17, 2017, 04:54:28 PM
-
So, I'm trying to get my minimap working and I'm trying to figure out how to use a circle mask. What is the best way to do this without having to write a shader (which I don't think should be needed as it seems like a simple thing for a GUI to do naturally)? I'm currently using UITexture so that the renderTexture can be used as the sprite, but I don't see anywhere for this to happen. Is there a better way for this to work? Any information that can be given would be greatly appreciated.
-
UIPanel can accept a clipping mask. Just specify a circular mask there, and it will clip everything below it. You don't need a shader for this, assuming you're going to be using the default NGUI shaders for the sprites within.
-
Thanks for the info, AM. I do have a problem with it, though. I setup the panel with the mask and it works...only if I manually changed the drop down to "None", then back to "Texture Mask". Do you know why it wouldn't just start working upon startup? I tried doing myMapPanel.Refresh() and myMapPanel.Update() and neither would force the panel to mask properly. It only works if I manually do it while the editor is running.
-
I gave this a brief test -- new scene, ALT+SHIFT+S, right click to make a new panel, changed it to use a texture mask for clipping and dragged the sprite underneath it. I then saved the scene, went to another scene and returned to the test one -- still clipped fine. Can you explain what you're doing differently?
-
I'm not doing anything differently. It's like this:
[Parent] MiniMap Panel
[Child] ->UI Texture (used for minimap)
MiniMap Panel is set to Texture Mask.
The UI Texture is given a Render Texture and uses Unlit/Transparent Masked shader.
Nothing else to say about it since it's pretty simple. Looks fine in the editor, but when I actually run the project, it goes back to being unclipped and I have to manually change the clipping. Doing it via software doesn't do anything. Maybe it has something to do with it being a Render Texture? Either way, I'm not sure what's going on, but not even changing it via software will work.