3d Grid of gameobject cubes

I wish to create a grid of cubes. I created a basic program with three for loops that instantiated gameObject cubes. The problem is lag. At around 50 by 50 by 50, the frames were utterly low. Should i be using something other than a gameobject cube. Is unity not ment for this?

If cubes aren't transparent it means that those inside are unnecessary, so you could write an algorithm that will create cubes only on the edges.

If the only thing you wan't to do is draw 50x50x50 grid of cubes you can use Graphics.DrawMesh

It will work faster, but I'm not sure will it work fast enough for your needs.