I’m making a quite simple world era script for my RimWorld like recreation. Nonetheless, the script is simply crashing Unity and has damaged my Spotify for the second on the time of asking this. Is there any means that I might repair my code in a means that works considerably?
Right here is my code:
utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEngine;
public class GenerateMap : MonoBehaviour
{
public int startingValue;
public int maxValue;
public int minValue;
public int width;
public int top;
public GameObject mountain;
public GameObject floor;
public GameObject water;
non-public void Begin()
{
for (int x = 0; x < width; x++)
{
for (int y = 0; x < top; y++)
{
int desiredValue = startingValue + Random.Vary(minValue, maxValue);
if (desiredValue <= 3 && desiredValue >= -3)
{
Instantiate(floor, new Vector3(x, y, 5), Quaternion.id);
}
if (desiredValue <= 4)
{
Instantiate(mountain, new Vector3(x, y, 5), Quaternion.id);
}
if (desiredValue >= -4)
{
Instantiate(water, new Vector3(x, y, 5), Quaternion.id);
}
}
}
}
}