adding multiple prefabs at once

hi,

i have 3 prefabs that work together.

i’d like to “force” the developer to use the 3 of them whenever he drags any of them on the scene. so if he drags the second one, the first and the third are automatically added to the scene too.

is there a way to do that ?

I don’t know your reason for it, so this may or may not work for you, but if I have objects that need to be in the scene I instantiate them all so when the game begins.

public GameObject cam;

public GameObject newPlayer;

void Awake()
{
	GameObject player = (GameObject)Instantiate(newPlayer);
	GameObject camera = (GameObject)Instantiate(cam);
}

This will let me drop a prefab onto the object containing the script (I have a gameController object in my scene for this purpose). If you have pro you can use asset bundles which you can get more info on from google.

that’s just for simplicity and error avoiding purpose .

i think the instantation solution may fit my needs. i didn’t hear about the asset bundles so i’ll check that too thanks.

actually, i saw the “RequireComponent” feature but as far as i understand it, it forces a component to be added to the script requiring it. in my case, i’d like to be sure all three of my prefabs are present in the scene by dragging anyone of them on the scene.

Not sure how to do that, but does it matter when the game isn’t running? Could just have an if(suchandsuch == null) then instantiate suchandsuch. I think having a gameController object is the best thing anyone can do for themselves… there’s even a tag by default for it, so I guess that’s unity’s way of saying “use me!” :stuck_out_tongue:

how does it work ?