It seems as if my last questions were a bit too specific, but this time this is (probably) not the case!
I have a big array with clouds (planes with a cloud texture) and I want them to move with a constant velocity. This works well, but I recently bought Unity Pro and according to the profiler this cloud movement script is extremely expensive! Is there a more efficient way to do that?
asked Dec 28 '11 at 09:23 AM
I don't see what is so taxing about it, but you could divide the loop between two updates using a coroutine if it is that bad. Pseudopseudocode:
More on coroutines here: http://unity3d.com/support/documentation/ScriptReference/index.Coroutines_26_Yield.html
answered Dec 28 '11 at 10:21 PM
Replacing the destruction code with simply resetting their positions will improve efficiency since memory management is expensive.
Also, make sure that your clouds don't have colliders on them. As far as I know, having colliders (without rigidbodies on them) means that they are treated as static collision geometry. Meaning that moving them will cause the static collision system to rebuild itself every update, which is quite slow and totally negates its purpose.
Before you spend too much time on this, are the clouds inefficient enough to adversely affect gameplay? Is there a real reason to spend time improving them?
answered Dec 31 '11 at 09:20 AM