- Home /
Objects flickering between dark and light
I'm currently building a Unity iOS game, in the editor all of the objects are fine however when I run the game on a device some (and it is only some) of the objects flicker between dark and light (it'll be dark and then a few seconds later it will be light and so on) when the camera moves around. I have only one light in the scene and that is a directional light. Even if I remove the textures from the objects then they still flicker however if I remove the directional light and turn up the ambient light then the objects do not flicker. The objects have been imported from Cinema 4D, I've done this many times and never had any problems it just seems that a few of the objects I have imported into this game just aren't working properly.
It seems that i've tried just about everything to try and fix this including reimporting the objects, retexturing them etc and it still isn't working. I'm really stuck and so any help would be much appreciated!
Thanks in advance,
ROM
EDIT: It appears the problem only exists on the iPhone 4. I've tried it on the iPhone 3G and an iPod Touch 2nd Gen and the problem doesn't exist. Just the iPhone 4 :/
Which shaders are you using on these flickering objects?
Just a long shot, but try the $$anonymous$$obile/Diffuse shaders and see if that makes any difference.
ran into this same problem, testing on a 3gs. No luck with a solution, I guess? I've disabled casting and receiving shadows, but no effect, otherwise same scenario as RO$$anonymous$$, single directional light, tried reimporting assets. $$anonymous$$indof out of ideas at the moment, though I'm still groping for more, hoping someone has an idea what's causing this...
Ok, some more info here.
first, dunno how I didn't notice before, but the lighting fails when more than one instance of the prefab is in the scene, but not when 2 are in the scene.
The instances are normally created dynamically by a scene manager. I tried adding static instances in the scene directly in unity, and get the same behavior - but separate for the static and dynamic instances. I.e., one of each, lighting is fine. Add a second of either - static or dynamic - and all of that type go dark. Neither affects the other, though.
Lastly, isolated this as being some sort of problem with the mesh itself, or with the way it's imported; used a unity sphere to build a new prefab with all the same components and settings, and they work perfectly, no problems at all. The mesh was created in blender; I just deleted the default cube, replaced with with a sphere, centered it, and exported. I build a new sphere mesh in blender the same way, got the same problem.
To clarify, as with original question, only happens on iphone, but happens on both my 3gs and in the iphone simulators.
Gotten late, need to call it a night rather than keep beating my head against this until the sun comes up. Will bash on it more tomorrow, and post a solution if I find one. I'm not sure if this is the same problem as the OP, though, so didn't want to create a new question.
Answer by suparlava · Sep 10, 2015 at 05:55 PM
In Edit > Project Settings > quality > Rendering section > Pixel light count, set it to something like 32. That's the maximum allowed lights count set to scene. In my case, directional light flickered after I added 5 point lights to scene while default max count was equal 4.
Answer by Paulius-Liekis · Jul 16, 2012 at 01:02 PM
Usually this is caused by a bug in Batching. Try disabling batching and see if that works for you. You can build your game without batching (most games do not use GPU that much, so they can run without batching just fine).
I had similar problem, where duplicated textures will not receive lighting if dynamic rendering is turned on. But this increases my draw calls, and defeats the purpose of spriting all on same texture.
switched off the Dynamic Batching in Player Settings and it worked for iPhone4, flickering gone.
Answer by arun_gopalan · Dec 05, 2011 at 12:49 AM
OK. Not sure where my previous answer went.
We are having the exact same texture on/off issue. We have one directional light and this happens on the iPad only. Did any of you find the reason for this?
Arun
Answer by richyz · Jul 03, 2013 at 06:43 PM
In Build/player settings/resolutions and presentatios clik in use 24 bit Display deph buffer, this will fix it