Home Game Development unity – What ought to I do to exclude objects getting instantiated on a sure space throughout the perimeter I’ve set?

unity – What ought to I do to exclude objects getting instantiated on a sure space throughout the perimeter I’ve set?

0
unity – What ought to I do to exclude objects getting instantiated on a sure space throughout the perimeter I’ve set?

[ad_1]

    public class RocksSpawn : MonoBehaviour
{
    [SerializeField] GameObject PrefabRocks;
    [SerializeField] int Spawned;
    void Start()
    {
        for (int i = Spawned; i > 0; i--)
        {
            SpawnRocks();
        }
    }

    void SpawnRocks()
    {
        Vector3 SpawnX = new Vector3(Random.Range(40.2f, -124.75f), -0.58f, (Random.Range(129.31f, -36.05f)));
        Instantiate(PrefabRocks, SpawnX, Quaternion.identification);
    }
}

this is the instance. There’s a particular space I do not need it to spawn is inside that “SpawnX” I’ve put up, Any options what I ought to do? I used to be to place AABB bounds however, no tutorials have on this. Please let me know if there’ different various too.

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here