Tuesday, September 12, 2023
HomeSample Page

Sample Page Title


I’m making a quite simple world era script for my RimWorld like recreation. However, the script is simply crashing Unity and has damaged my Spotify for the second on the time of asking this. Is there any manner that I might repair my code in a manner that works considerably?

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;

    personal void Start()
    {
        for (int x = 0; x < width; x++)
        {
            for (int y = 0; x < top; y++)
            {
                int desiredValue = startingValue + Random.Range(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);
                }
            }
        }
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments