How can I 'unparent' my camera?

This may be a confusing question/title, but I am using a character controller and I have this flat cube game object with a script attached that spins 360 degrees on a loop. In order for my player to spin accordingly, I have a script + trigger that parents the player object when standing on that rotating cube.

But since I have my main camera as a component of my player game object, my camera spins on its own rather than based on the players mouse movement and it just makes you dizzy since its spinning constantly with the cube.

Is there any way to make the camera work like normal, as if I’m not standing on a spinning object?

Most camera systems don’t have the camera as a child of the player. Instead, have the camera a child of an empty game object that - via code - follows the player around.

That’s something that I will try now.

With that being said, is there a reason why in every single guide video or even paid assets on the Unity store, they all have cameras under the player game object? I’ve only found one extremely advanced asset where it’s done differently.

Likely just bad design. Without being a child of the player it has a lot more freedom to do things like smoothly move around the player without inheriting every little bump the player encounters, move at a different speed than the player, freeze in place, pan to the side, etc.

Hard to answer that question. I imagine video guides might do so because it’s just easier for newer users to understand.

But every camera system I’ve done has involved having the camera system being a separate group of game objects from the player. In one case the camera is in its entirely own additive scene.

Also best not to forget about the existence of Cinemachine. You can likely save a lot of time using its pre-existing solutions.

Late reply but I fixed the entire problem and made my camera separate. The camera only rotates based on my mouse input, but now as a result of that, when I move on that spinning object that my player is parented to, my movement becomes wonky and feels inverted, until I am unparented. Is this a whole separate issue that I should be looking to? I believe it’s a matter of world movement?

Your player’s movement direction should be based on the direction of the camera (rather than the direction of the player), if it isn’t already. You’ll also need to make sure you’re moving a player in a world direction.

Also consider if parenting the player to the platform is the right implementation choice here. There are other ways, such as the player controller checking for changes in movement in the object its standing on, or, if the player is using rigidbody movement, make sure the platform is being moved via physics.

I had no idea that there were alternatives to this when using a character controller. All I’ve learnt and been taught was to “always make sure you parent your controller to the object you are standing on” like for example if you have a platform that moves left to right so that you stick to it and don’t fall off. That’s why I’ve been so adamant with parenting but I have noticed quite a number of drawbacks.

But with what you’ve said, is that essentially similar to how you would check if a slope is under you, so that your player does different movement based on that?

There’s always many ways to achieve a result, especially in game development. Some are easier than others, but the result won’t be as desirable. Others will be more complicated, but get you a better result. Just a matter of testing and experimenting to get the result you want; sometimes this includes using multiple different solutions.

In a way, yes. In this case, you’re seeing if the game object the player is atop of has moved/rotated since the last frame. And if so, moving and rotating the player with it.

It depends on what particular method you’re using to move your player, too. Whether that’s the built in UnityEngine.CharacterController component, or a regular rigidbody.