Drawing 10,000 cubes efficiently?

I’m an Unity noob, and I just started today.
I have a cube (3x3x3) with some simple texture.

I know from XNA that, if you try to draw this cube 10,000 times, you’ll need to implement hardware instancing (with shaders etc).

While in Unity, I tried doing like this:

    for (int x = 0; x < 100; x++)
		{
			for (int z = 0; z < 100; z++)
			{
				var instance = (GameObject) Instantiate(Resources.Load("Cube", typeof(GameObject)));
				instance.renderer.material.mainTexture = (Texture2D) Resources.Load("CubeTexture", typeof(Texture2D));
				//cube = instance;
				instance.renderer.transform.position = new Vector3(x*2, 0, z*2);
				instance.renderer.transform.localScale = new Vector3(100, 100, 100);
				instance.renderer.transform.RotateAround(Vector3.right, -90*Mathf.Deg2Rad);
				
			}
			
		}

To my surprise it worked pretty well with no performance loss.
I KNOW this isn’t the best way to do it, so my question to you guys is, what would be the best way to do what I am doing now with the code above.

Thanks :3

If the cubes are meant to be largely static (like Minecraft), then you can use the Mesh class to construct groups of cubes. There are various topics on the Unity forums about this. Otherwise, if they have to be individual cubes, then what you have is pretty much the way to do it.

As an aside, instead of using Resources.Load, just assign public variables in the inspector. It’s a little better for performance, but more importantly it means not hard-coding your scripts and it makes it easier to manage your projects.