Hi All!
I have a weird problem trying to implement a UIDraggablePanel with Clipping. I am almost certain it's related to shaders but I've spent a couple days on it and not figured it out - maybe you can help me. Here's the set up in the scene:
UIRoot(2d) (with UIPanel) > Camera > Anchor > Panel (with UIPanel and UIDraggablePanel script attached, also a DeckManager script attached) > Grid
The Deck Manager script programmatically fills the Grid with Cards at runtime. The cards are all widgets. Cards scroll but do not get clipped. When I set the clipping to Alpha, Hard, or Soft, all of my cards disappear. All the cards are in a single atlas at the moment. The shader set on the atlas is "Unlit/Transparent Colored". If I set the shader on this atlas to "Unlit/Transparent Colored Overlay" instead, the cards appear while clipping is on, however, they do not clip softly. I guess that part's obvious, but it shows that this is something with the shader for sure. It's not finding the Soft Clip shader for some reason. The NGUI shaders are all inside my Resources folder. I compared the "Unlit/Transparent Colored (SoftClip)" to the shader I have in a project where the clipping is working properly, and the shader code is the same.
Other things in the FAQ that I checked are as follows:
1. Check to make sure that you have shaders turned on. This means NOT targeting GLES 1.1, and NOT having your quality set to Fastest.
-- I am building to target iOS, so the Fastest setting doesn't seem to apply. Still, I set my Quality settings as high as possible for Default. Also, In Edit>Graphics Emulation> I selected GLES 2.0.
2. Make sure that the atlas used by your widgets is using the Unlit/Transparent Colored shader. If you have Simple Textures (UITextures) in there, make sure that they too use this shader.
-- Yes, this is set for the atlas. I do not see a shader setting for the individual textures. I have them all set to Advanced and TrueColor format.
3. Make sure the clipped panel uses uniform scale: (1, 1, 1).
-- Yes, the panel and the grid are both scale (1,1,1).
4. Your widgets that you want clipped must not have an extra panel in between of them and the clipped panel. Open the Panel Tool, select one of your widgets that should be clipped, and note which panel gets highlighted in the Panel Tool. If it's not your clipped panel, then you have an extra panel in there that you should remove.
-- Yes, I checked this in the panel tool and the panel selected for each card is the clipped panel.
5. Make sure that the shaders can be loaded properly. Did you move the NGUI's Resources folder somewhere?
-- Hmmm. Not sure. How do I check that shaders can be loaded properly? This is probably the problem, but they are in the Resources folder. Isn't that right?
Is there some way I can check what shaders are being used by each object? I am rather new to Unity so I'm not sure that's how it works, but I think that would be helpful if I could check them by debug logging.
Any ideas friends? Thanks in advance for your help!