I've been working in the Mono version of 3.2.1 (and 3.2.2) to develop a top-down ARPG, but I may have run in to a major roadblock. After searching around for the best way to build out my art pipeline, I thought I had found the exact technique I needed. Using viewports to render a 3d object (main character) in a 2d project seems to do the job I had in mind to a tee. I found these resources as examples:
Example project on the Godot Github:
Video explaining the process:
Among others. The documentation also talks about this process. However, every example I've found only uses GDScript. I went ahead and tried implementing this in a test project using C# instead. This is one version of the script I wrote:
public class test : Node2D
public override void _Ready()
texture = (Texture)GetViewport().GetTexture();
screen = (Sprite)GetNode("Screen");
public override void _Process(float delta)
screen.Texture = texture;
I believe that the above should do effectively the same thing as the GDScript examples, however the results are pretty bizarre. It's tough to describe what it looks like on running it, but with the project otherwise built exactly the same way as the YouTube example, the place-holder images glitch and slide across the screen in pieces, with no sign of the 3d object at all. I've tried building the code and the project a few different ways and playing with a lot of options in the editor, but always with the same result. It's as if the texture from the viewport doesn't read properly in or out of video memory? Or maybe something in the bindings to cast a ViewportTexture object to Sprite.Texture doesn't work as I expect?
Just to confirm; I rebuilt the project in GDScript as well and it worked perfectly.
I'm pretty dead-set on continuing development in C#, but not sure I can without access to this technique or a similar one (I've built many of the other game mechanics in C# already). Does anyone know if this is a bug or am I scripting this incorrectly? I hesitate to open an issue on Github until I know that the error isn't mine (and I really hope it is so I can move forward!)