I’m running into an issue with video in-game. I have a .ogv (ogg) encoded video with audio. I applied it to a material and applied that to a plane in my game world. I applied the audio to the plane too. I applied the .JS code to get both to run. When I test it in the Unity Editor, it plays perfectly in-game with no performance lag whatsoever. The movie is 58 sec long.
However, after Building and Running the game, (whether the movie plays or not) about 30 seconds after the start of the level the game freezes. The only thing it will respond to is a Force Quit key command (Option+Command+Esc). When I would trigger the movie to play, it played fine but the game still froze after 30 secs anyway.
Why would it work in-editor but not in the final build?
(Mac OS 10.6.7 / Unity Pro 3.3.0f4)
(updated to include the consistent 30 seconds factor)
More info-- this freeze happens exactly within 30 seconds from the start of the level or the first moment I look around w/ the mouse.
Anyone have any spitball ideas here?
Made a separate test scene and imported the exact same plane + movie. It played fine with no freezing on Build for 20 minutes.
Back in my original scene with the problem, if I remove the movie, the scene does not crash in the Build. So I’m inclined to think it’s related to a memory leak or ceiling somehow, but that’s a wild guess and the console isn’t throwing errors.
I took screenshots of the Statistics counter at the start of the level and the end of the 30 sec window (in the editor). No stats change.
So I’m confused…
(help)
For anyone that cares, I solved this.
Wow.
Every 30 seconds from game start (from the Build), Unity Player was spinning up my external hard drive. I ejected it and did a test and there was no freeze. So apparently, Unity Player running video in-game hates external hard drives?
…
So it seems this is a bug with Unity Player and video in-game. Again, it only happens in a Build, not in the Editor.
(Mac OS 10.6.7 / Unity Pro 3.3.0f4)
Nope. Didn’t solve it. The game ended up crashing half a minute after the video finished playing (which is, at least, an improvement over it crashing 30 seconds into the start of the level).
I could work with that if I can add and destroy the video gameobject at the start and end of its use… I’ll test that tonight.
Still, that’s not really a valid solution, but more a workaround. What would possibly be happening with Unity Player that would cause it to cry about video? A bug working with the video card?
I have a Summer 2011 27" iMac.
Sure it crashes? or does the log explode with unrecoverable exception?
If it is the exception: We have the same problem.
Through usage of debug build and hooking up the xcode debugger I was able to pin it down in our case to camera culling → terrain → Tree blend → PerlinNoise function which throws the unrecoverable exception.
The only solution to it is to disable the terrain completely.
Also, the bug was introduced with Unity 3.2 and is still present in 3.3, while Unity 3.1 didn’t have it.
As soon as I’ve time I will create a replication case for UT so it hopefully can be fixed for 3.4 as this is an extremely odd one (if a UT staff member wants a screenshot of the crash callstack before the replication case is ready please drop me a pm / mail)
I did in fact have a terrain in the problematic scene. In the alternate test scene where it did not freeze, there was no terrain. Thanks for the info! I hope this problem gets resolved very soon!