- Home /
Setting positions of cubes directly without using transform
In a simple project with 16k cubes in it, CPU time grows up to 90milliseconds because of updating their coordinates with simple transform.position assignments.
I searched and found out that it must be done within main(UI?) thread.
Can I somehow directly write the latest coordinates of cubes without touching transform?
The lagging part is this:
for (int i = 0; i < cubes.Length; i++)
{
Vector3 dv = new Vector3(x[i], y[i], z[i]);
cubes[i].transform.position = dv;
}
maybe there is a way to update all array of cubes in a single step(such as swapping arrays? so I can work on detached one with multithreading?)
Also I couldn't find a way to stop UI to work on objects concurrently.(would stopping be enough?)
Answer by Cuttlas-U · Apr 16, 2017 at 07:47 PM
hi; thats too much cube ;
are all of those cubes in your camera view ? if not try to disable the mesh renderer of those wich are not in your camera;
but to suggest more idea i need to know what is this about and why do you need that many cubes to find a way avoiding it;