public void Update(){
GameObject newBee = Instantiate(bee, gameObject.position, Quaternion.identity);
newBee.transform.parent = transform;
newBee.transform.position = gameObject.position
}
If you put this script on your beehive then it spawn bees at it’s position. Creating a reference to the new bee allows you to manipulate its data, you can set the parent and position and anything else you need. gameObject and transform will be the one the script is attached to, so setting parent to transform will be the beehive that the script is on and same with position.
Then you make a prefab of your beehive by dragging it in a folder, you use another script with a reference to your beehive that spawns your beehive.
GameObject beehive;
public void SpawnBeehive(){
Instantiate(beehive, position, Quaterion.Identity);
}
Then you put that method on a button.