I was creating Voxels, when suddenly, my projectile was... I don't know - removed or something - but it wasn't removed :|
I was creating Voxels and this happened (this is the entire code):
public GameObject Mesh;
float cubeWidth;
float cubeHeight;
float cubeDepth;
public float cubeScale;
void Start()
{
cubeDepth = transform.localScale.x;
cubeHeight = transform.localScale.y;
cubeWidth = transform.localScale.z;
gameObject.GetComponent<SpriteRenderer>().enabled = false;
print(Mesh);
Mesh.gameObject.GetComponent<Transform>().localScale = new Vector3(cubeScale, cubeScale, cubeScale);
CreateCube();
}
private int Index;
void CreateCube()
{
for(float x = 0; x < cubeWidth; x+=cubeScale)
{
for(float y = 0; x < cubeHeight; x+=cubeScale)
{
//print("Starting Y");
for(float z = 0; x < cubeDepth; x+=cubeScale)
{
//print(Mesh + " before creating Vec + " + Index);
Vector3 vec = transform.position;
Vector3 newvec = vec + new Vector3(x,y,z);
GameObject cubes = Instantiate(Mesh, newvec, Quaternion.identity);
//print(Mesh + " after creating Cubes + " + Index);
Index += 1;
}
}
}
}
My console says this:
Any ideas?