C# AlbedoTexture

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By gyrosp

Hi :).

I’m trying to translate this gdscript line to C#:

get_node("Viewport_quad").material_override.albedo_texture = viewport.get_texture()

Using C# there is no AlbedoTexture. (“Viewport_quad” is a MeshInstance).
Could someone please help me to translate this line of code to C#?

Best regards

:bust_in_silhouette: Reply From: davidoc

Remember C# is strongly typed and you should cast to the proper class. MaterialOverride is a member of MeshInstance and AlbedoTexture is a member of SpatialMaterial.

        ((SpatialMaterial)((MeshInstance)GetNode("Viewport_quad")).MaterialOverride).AlbedoTexture = GetViewport().GetTexture();