As for your problem. Since you are instantiating stuff and that takes a position param all you really need is a position
So what you could do:
While in the designer, take an empty GameObject and put it in the center of the area around which objects may get instantiated;
Assign a Collider and Rigidbody component to it;
Set rigidbody to be kinematic and the collider to be a Trigger;
Size the collider so that its area suits your needs;
Attach a script to your player that would check when its collider enters the Trigger area of your box ( basically do stuff inside the OnTriggerEnter() method in your player’s script);
Choose a random position vector within the box to instantiate your objects;
This doesn’t provide much coding help but it should give you enough info to ask more interesting questions
sorry i forgot to say that i use Raycasting for instantiating the objects at mouse position. players should also be able to instantiate objects when standing outside of the area.
so I dont think your suggestion will help in that case.
But thanks anyway
If the player’s position is irrelivant, just check the mouse position and if its within bounds, set a boolean to true. if its true, the player can instantiate, false, they cannot.