In one script i have the variable:
public int mapSize = 10;
Then i’m creating a grid of gameobjects and it will be always 10x10 if it was 11 then 11x11 or 9x9.
In another script:
using UnityEngine.UI;
using System;
public class WayPoints : MonoBehaviour
{
public GameObject[] wayPoints;
[Range(5, 50)]
public int waypointsCount = 44;
private System.Random random = new System.Random();
// Use this for initialization
void Start ()
{
var Nodes = UnityEngine.GameObject.FindGameObjectsWithTag("Node");
}
// Update is called once per frame
void Update ()
{
}
}
I set the Range min to 5 ans max to 50
But i know that the map size is 10 so there will be 100 gameobjects.
So the range should be min 5 max 90 or maybe min 5 and max 50.
The problem is how can i make sure i will not set the Range max to be more then the map size ?
If the map size will be 5 so it’s 25 gameobjects i can’t set the Range max to 50.