How do you use prefabs, nested prefabs and prefab variants to keep a Unity project organised?
What the interviewer wants to hear
- Prefabs are reusable templates; edits propagate to instances
- Nested prefabs let a prefab contain other prefabs
- Variants inherit from a base prefab and override some values
- Keep overrides small and apply changes to the right level
- Avoid editing many scene copies by hand
Model answer
I treat prefabs as the building blocks of the game. Anything used more than once, like an enemy, pickup or door, becomes a prefab, so a fix to the prefab updates every instance in every scene. Nested prefabs let me build bigger pieces from smaller ones, for example a room prefab that contains door and light prefabs, while each keeps its own source. Prefab variants are useful for related objects: a base Goblin prefab with variants for Archer and Shaman that only override a few values or add a component. I try to keep scene overrides small and push real changes up to the prefab or variant, otherwise it becomes hard to know where a value comes from. The overrides dropdown helps review this.
Can you answer it under time pressure?
Take a timed easy round and get scored on every answer.
More easy Game Developer questions
- What is a game loop, and why is delta time important?
- In Unity, what is the difference between Awake, Start, Update, FixedUpdate and LateUpdate?
- How do you use vectors, dot product and cross product in game development?
- How does collision detection work in a game engine, and what is the difference between a collider and a trigger?
- Tell me about a game or game feature you built. What was the hardest problem and how did you solve it?
- Why do game engines like Unity and Unreal favour components over deep inheritance trees for game objects?
- How would you set up version control for a small game team with programmers and artists?
- What do you do as a programmer to make a game "feel" good to play?
- What are coroutines in Unity, and when would you use them instead of Update or async/await?