When to instantiate

I have a house with several rooms. I want to instantiate characters in different rooms. Should I do that when the scene is loaded even though they are not in view or should i instantiate them when the player enters that room?

Hello There.

Depends on you project. Both ways are correct. If you load them at the start, they will “use CPU” all time, but will not need “extra CPU” when entering the room. If wait until the player is here, will use “extra CPU” at that moment, so maybe game freezes for 0.1 seconds.

As i supose you are only talking about 2, 3 or even 10 objects, it really doesnt matter. Dont worry for that. If we where talking about more than 100 objects, then, performance is important.

But for you, dont worry.

PS: You can instantiate them at the start, and then turn them off (Not destroy, only SetActive(false)) Which will reduce CPU consumption, but will not need to instantiate them, just turn on again.

Bye!

Sorry for the late reply. Your response was in my junk folder and I just now found it.
Great answer! it was exactly what I was looking for and more. Yes I am only talking about 5 to 10 objects so no worries.
Thanks