I want to have a 2D art background in a 3D world.
I copied everything - all the codes and the properties from the 2D in 3D demo in the asset store but i can't seem to translate it at all in my project.
This is my node structure
+ game (Node)
|-- (other nodes of the project here)
|-- viewportQuad (MeshInstance)
| |-- background (2D Node scene)
< background 2D Node scene >
+ background (2D Node)
|-- sprite (Sprite)
| |-- bgLayer1 (Sprite)
| |-- bgLayer2 (Sprite)
| |-- bgLayer3 (Sprite)
| |-- bgLayer4 (Sprite)
I tried to extract the nodes of the background scene and made the sprites a direct child of the Viewport node but still no luck. I still don't see anything.
This is the script i copied from the demo.
var viewport = getnode("Viewport")
getnode("viewportQuad").materialoverride.albedotexture = viewport.gettexture()
It's basically 5 lines of code only so it's supposed to be straightforward. What am i missing here?
print_debug(viewport.get_texture()) doesn't help. It just shows you something like a resource (i don't know what it is.) Like:
^ Idk how to use that for investigating or debugging.
Maybe there is a different way of seeing a viewport's texture to debug this?