Debugging, Development notes

Unity 5 bug: psychically linked textures on Gear VR

I was creating a simple application for Gear VR in Unity 5.x which was encountering a strange bug where after two seconds it would stop working. Eventually I boiled it down to a minimal reproducing scene that looks like this: 16d9a631a8ba7e82bdf164f87e2e8f78This is a very simple scene: it contains two quads that have two different 4096×4096 textures applied to them, compressed with ETC2 (GLES 3.0). There are no other objects and no active scripts or shaders. Everything else is disabled. When I run it in the Unity editor, the result is what you would expect: the two quads just sit there, with their two different textures, indefinitely. When I build and run the same app on Gear VR on the Note 4, a mysterious and inexplicable event occurs: the app runs correctly for 2 seconds, and then the quad in the back magically changes to have the same texture as the quad in the front! Recall that there are no scripts running. If I disable the quad in the front, this behavior does not occur. Just to be sure, I re-created the quad in front from scratch, to make sure it had no implicit link to the other. The behavior still occurs. After downgrading to Unity 4.x, this behavior vanished and it worked as expected. So it’s most likely some kind of Unity 5 bug. I can only speculate why this occurs. Maybe some internal failure is causing one of the textures to be lost, and so it reverts to the other texture. Maybe it thinks one of the textures has no references, so it’s being garbage collected at the first opportunity. Whatever it is, I should have trusted people who said Unity 5 wasn’t yet safe to use with Gear VR.

Edit: Apparently some people are using Unity 5 for Gear VR with fairly sophisticated projects as shown in this guide. I have no idea what the difference is that’s causing them not to hit the same issue – as far as I know I set up the same way.

Advertisements

2 thoughts on “Unity 5 bug: psychically linked textures on Gear VR

  1. Hi there,
    I’ve the same problem right now in a very simple demo scene. I’ve got a floor and an animated object. After two or three seconds the floor gets the texture from the animated object. I’ve disabled the script, so there is no animation or whatever going on.
    Using Unity 5.0.2f1 (64bit) and the latest Oculus VR ovr_mobile_sdk_0.6.0.1

    Any idea?
    Did you solve that issue back then?
    Thanks

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s