- Home /
Question by
Afonso-Lage · Jul 08, 2012 at 02:56 AM ·
gameobjectloadlag
GameObjects load problem
Hello everybody!
I'm trying to make a game minecraft like, and i'm having problems with GameObjects load on Unity3D.
I have a Cube, with a material texture with 180 bytes. And when I try to start the game with more then 30k cubes, I take about 3 minutos to start and is sooo laggy...
There is any better way to load a huge ammount of objects then simple creating a new GameObject?
This is my code:
GameObject newCube = GameObject.CreatePrimitive(PrimitiveType.Cube);
GameObject model = GameObject.FindGameObjectWithTag("MyModel");
newCube.transform.position = new Vector3(x,y,z);
newCube.renderer.material.CopyPropertiesFromMaterial(model.renderer.material);
newCube.renderer.material.name = model.renderer.material.name;
Comment
Answer by Afonso-Lage · Jul 12, 2012 at 04:49 AM
Well,
After many researchs and tests, I got 125k Cubes to load in 1,5 seconds...The Unity3D Engine is soo cool...
So the answer to my question is:
"Yes, you can, the better way is to use design pattern and read about memory utilization on C#."
Best regards,
Afonso Lage.