0 votes


right now I'm porting my game from Godot 2 to Godot 3. It's a 2D game with a HUD on the right side of the screen. In Godot 2 I used the following structure:

-> Game (Root node)
--> MainGameArea (Control)
---> Viewport
----> MainGame (Instance to the Main Game (without the HUD))
-- > HUD (Instance to the HUD which is a CanvasLayer)

That worked pretty fine in Godot 3 but not in Godot 2. I tried to change the MainGameArea to a ViewportContainer but I still can't see the MainGame scene. I only see the HUD and hear the music of the MainGame scene playing, so the scene is loaded but not visible.

How can I solve this problem or is there a better way to do this?

in Engine by (50 points)

Why do you need a Viewport? The root of the scene tree already is one.

Also it looks like your HUD should work, so if your problem is that you can't see your game viewport, you should change your topic title.

I want to use a Viewport so the main character (with the camera attached) in always in the center of that area and not in the center of the window. It should be in the center of the window minus the space for the HUD on the side.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.