Portal2 & Player Setting

 So after getting the portals to look good, I moved on to making them actually work — meaning: when a player walks into a portal, it should load the next scene.

Simple, right?

Kind of.

First Attempt: One Player Per Scene (Disaster)

At first, I had a separate player prefab in every scene. It made testing easier, especially for checking colliders and first-person movement. I was focused on making sure the mesh colliders and terrain felt right under the player’s feet.

But once I added actual scene switching, everything broke.

Whenever I moved between scenes, Unity would load the new one with its own player object — meaning I suddenly had two players in the same project, sometimes both active. It led to all kinds of bugs: camera confusion, overlapping controls, audio source conflicts… total chaos.

The Fix: Keep the Player in the Main Scene

I turned to ChatGPT (again) and followed a smart suggestion: only keep one player, and manage it from the main scene.

Now, instead of spawning new players in every scene, I just move the existing player into the right spot. The sub-scenes are loaded additively, and the main player persists across all of them. Problem (mostly) solved.

Small But Annoying Bug: The Flashing Capsule

One weird side effect: the player’s capsule (the visible body or collider shape) started flashing on screen briefly before the intro video even played. Not ideal.

I think it happened because the player object was already active at scene start, and the camera wasn’t positioned yet — so for a frame or two, the player capsule popped up in front of the screen.

I tried a few things:

  • Disabling the player mesh at the beginning

  • Moving the player off-screen and teleporting them back after the video

  • Adding a delay before enabling controls and camera follow

Eventually, I got it working after a few rounds of trial and error. Now the player stays hidden during the video, and only becomes active when the interactive part begins.

What’s Next?

Now that the player is stable across all scenes, I can finally move on to polishing portal transitions and maybe adding some ambient audio cues when entering a new world. Still a lot to do, but this was a big step.

Comments

Popular posts from this blog

Creating a Portal System with Player Collision in Unity

Three Types of Scene Project

Research concept