0 votes

Here is what I'm currently trying:

var sprite3d = Sprite3D.new()
var viewport = Viewport.new() 
add_child(viewport)
var viewport_texture = ViewportTexture.new()
viewport_texture.set_viewport_path_in_scene(viewport.get_path())
sprite3d.texture = viewport_texture

However I'm getting the following error:

0:00:05:0418 - Condition ' !vp ' is true. returned: Size2()
----------
Type:Error
Description: 
Time: 0:00:05:0418
C Error: Condition ' !vp ' is true. returned: Size2()
C Source: scene\main\viewport.cpp:106
C Function: ViewportTexture::get_size

Makes me think that maybe the viewport_texture isn't actually using the viewport and isn't displaying any texture. Any help appreciated.

in Engine by (12 points)
edited by

You never assign the viewport_texture to anything. How is the viewport meant to know, that it should use it?

Have your read this?

I updated it but I didn't think that adding the texture to a sprite was relevant, I would still get the same error

The problem here is that the viewport texture doesn't know what the node path is relative to, and as far as I can tell the only thing configuring that is the packed scene system. Not sure this can be fixed without modifying the source code.

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 Frequently asked questions and 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.