how to restrict random spawning in particular defined region?,

i restricted spawn area to be in screen size but i want it to be restricted in particular area as well…

Good day.

Its simple, when yo uinstantiate, you use a Vector3 position.

So before Instantiate, lets define a good position.
A good way to do it, is create a collider in the forbidden zones ( or the allowed zones) to instantiate an empty objecct with a collider, that you can check if is instantiated inside that area (or outside). Once you know that, you can destroy this emptyobjectm and use that position for Instantiate the object you wanted in first place. IF is not a good area, randomize another spawn osition again and do the same, until you get a good position.