Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: FractalCore on July 27, 2012, 10:20:15 PM

Title: Pre-Load Objects Without The Stutter, Like In GTA
Post by: FractalCore on July 27, 2012, 10:20:15 PM
I'm attempting to get a large environment working, similar to the way I'm guessing GTA does (large unique objects of city streets and buildings that load when the player gets near). I can get that working using a basic Get Distance to player action setup. But there's a slight pause when it loads the mesh before it creates it, I use the Create Object action and then a Destroy Object once it's out of range.

Could the Create Object action come with some kind of load first, display once loaded option, or a separate action that pre-loads the asset that's required, gets it ready basically.

I thought Asset Bundles might be the way to do it, but they're Unity Pro only (I have Pro but others don't who might want to do this), and I don't want to stream assets off a website or something, so that system seems like Pro-only overkill. Plus I'm no programmer and I couldn't even get the official demo project to work :)
Title: Re: Pre-Load Objects Without The Stutter, Like In GTA
Post by: jeanfabre on July 29, 2012, 04:48:25 AM
Hi,

 The way to achieve loading of objects without too much performance hit is to use a pool manager where your assets exists already, only not in the scene, I have ported poolManager for instance, so that you can work with that from playmaker:

https://hutonggames.fogbugz.com/default.asp?W839 (https://hutonggames.fogbugz.com/default.asp?W839)

study what poolmanager is all about before committing tho.

bye,

 Jean


Title: Re: Pre-Load Objects Without The Stutter, Like In GTA
Post by: PlatinumPlayer on July 29, 2012, 07:47:10 AM
If you own unity pro 3.0 or higher i believe GTA uses Occlusion Culling, the method of not rendering assets that are out of view of an active camera.

http://docs.unity3d.com/Documentation/Manual/OcclusionCulling.html

Everything is preloaded but only what you can see is rendered so there is no performance hit. If however you want dynamically spawning objects/buildings i think jean is right to go with a pool manager. I already use a pool manager for enemy spawning to make sure everything is smooth and well organized.