- Home /
Spawning objects at points within another object?
My group has a bunch of random chunks of map that spawn, but within those chunks we want to set some sort of anchor points or gizmo or however unity does this, points where other objects, small groups of models such as crates or background details should spawn after it spawns the larger map chunk.
How would we achieve this? How do you set some sort of anchor or location where other objects should spawn, and then reference to it and make things spawn there?
Thanks!
Answer by Julian-Glenn · Jul 20, 2010 at 07:24 PM
Instantiate is your friend:
http://unity3d.com/support/documentation/Manual/Instantiating%20Prefabs.html
http://unity3d.com/support/documentation/ScriptReference/Object.Instantiate.html
You could also use Resource.Load if you place the prefabs in /resources: http://unity3d.com/support/documentation/ScriptReference/Resources.Load.html
Also:
Your answer
Follow this Question
Related Questions
Instantiate Prefab at random 1 Answer
Spawning different random objects at the same position? 2 Answers
Why does inside unit circle use the world point? 2 Answers
Random array issue C# 2 Answers