How do i prevent video textures that share a shader from batching on Android?
I’m finding when I play back several video textures at the same time they share resources and swap from one to the other at runtime. The textures are actually part of Depthkit’s Unity package to display their 3D mesh content which draws it’s data from the video clips. I’ve tried a bunch of things to stop this happening but am struggling to really get it to stop.
So I’m trying to build from Unity 2021.3.2f1 for the Quest 2 VR headset (Android) from URP with ARM64, ASTC compression, IL2CPP. The whole thing looks fine in Unity Editor but when I build for Android and look in the headset it just keeps occurring.
Here’s what I’ve tried to fix it…
- Disabling “static” on the Gameobjects did not fix it
- Disabling “GPU instancing” on the materials did not fix it
- Disabling “Static batching” in Player preferences did not fix it
- Using individual materials for each video texture did not fix it
- Using individual shaders on the materials did not fix it
- Changing from OpenGLES3 to Vulkan fixed it once - but not in my current project
- Building Android as ARM v7 fixed it somehow once- but I can’t use this in my current project
In this Depthkit forum post they recommend disbaling “SRP Batching” in the URP quality settings, but it doesn’t show for me.
I’m running out of ideas…
-
could it be that the mesh renderers share a shader? is that the problem?
-
My shader in the Inspector states “disable batching : no” is it this?
-
Is it to do with Texture compression?
-
Is it a rendering/GPU issue?
-
Is it that the Quest has cached a shader and is just showing me the old shader so I’m not even sure if my changes are being displayed properly?
-
I’ve been told to use AVPro which I don’t have, is it to do with Unity’s Video Player somehow?
Any ideas/pointers would be welcome!
It’s driving me up the wall - what causes this swapping/sharing and how can i find a fix?
Ben