- Home /
to speed up performance
Hi there ;) My project is rising and I am at a point where I would be able to change the number of scripts. Right now I am using one "MainScript" with many variables like gameObjects, Transforms and Textures. My NPCs are owner of scripts and also the camera has one or two :) I am thinking about an own LOD system (Unity free) so I think I have to add "LODscript" to every object that gots a mesh... Question:
Is there any difference between one mainscript or many small scripts?
thank you ;)
Answer by ScroodgeM · Aug 25, 2012 at 08:07 PM
answer: both 8)
the best way to achieve rather any global (whole-scene) solution is to use one single controller for all common work and a small customizable, runtime apllying scripts to control separated objects.
example:
single controller that collects all objects affected from scene, on play start adds a script for individual controlling, controlling the camera's moves and runs an LodUpdate() method on all scripts when camera move detected. for far-placed objects LodUpdate() can be totally ignored on small camera moves. objects can be grouped for simple distance checks for whole groups instead of each object.
script: simple script with LodUpdate() method, updates the LOD model depends on distance to camera.