how to build a 3 piece robot that triggers a door to open?

I am pretty new to Unity and i am trying to make a survival game that includes three levels. My first level will have a robot you have to piece together(E.G. Place body on legs and place head on body) and should trigger a door to open to the next level. Im not sure how to piece the robot together that make it look like its pieced together properly and how exactly it will trigger a door

Maybe show a bit of your code so we can see along what lines you’re thinking, but for starters, you will probably want a bool variable to tell if your robot is “pieced together”, like bool robotBuilt = false;
You could use the Animator to move and rotate objects, but if you’re learning a easier way will be to use prefabs. That way you can just instantiate them when needed. Something like :

  • Have an object (made into prefab) that has just the legs. (STAGE 1)
  • Have a 2nd prefab that has the legs and body attached. (STAGE 2)
  • Have a 3rd prefab that has the legs, body and head attached. (STAGE3)

Then, when needed, you can destroy the STAGE 1 object and replace it with the STAGE 2 prefab (Instantiate), then later you can destroy the STAGE 2 prefab and replace it with the STAGE 3 prefab. You might still want a transition effect when the robot is ‘built’, which is why the Animator can be useful.

Then when you do change to the STAGE 3 prefab (of the Robot fully assembled), you set the Boolean robotBuilt = true; , and when it’s TRUE, the door opens. You could have the Door object watching the ‘robotBUILT’ variable to see if it’s true (see: Accessing variables from other scripts), or use the Animator, it can set up a Bool Parameter (robotBuilt) and when it’s true it will trigger a transition to the Door’s ‘Open Animation’, for example, the Door raises up (on the Y axis). The Animator can also add Events to go along with the animation you set up for the door (see: Using Timeline Events), so you could have sounds play also when opening or closing.