Minecraft kind visibility render

Hello, i was looking for some kind of optimizing while rendering cubes in my voxel prototype. What i found was that it really slows when I use lots of cubes. I want to do it rendering only visible cubes and only visible faces but I’m lost.

I tried doing this with renderer.IsInvisible and OnBecameInvisible but they dont help because they dont render when they are invisible.

Also i couldnt figure how to do the faces thing.

Here is a screenshot about what i’m doing:

You’re right. This need to be optimized! Actually you don’t want to create a single gameobject for each block. Instead you want to create a chunk objects that hold each like 161616 blocks. These blocks are rendered using a mesh that’s being created at runtime. This is actually a quite advanced topic but there are some good (YouTube) tutorials out there on how to do it. But please don’t try to create a new cube prefab for each block! You might also want to check out my voxel engine in the Unity assetstore. It is quite a good base to start off with a voxel game: Unity Asset Store - The Best Assets for Game Making