Last active
March 17, 2023 17:17
-
-
Save spaceyjase/828900f4c9c3f714514c5a16364ca277 to your computer and use it in GitHub Desktop.
Assign a texture to Albedo in Godot 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Godot; | |
using System; | |
public partial class TextureTest : Node3D | |
{ | |
[Export] private Texture2D texture; | |
public override void _Ready() | |
{ | |
var mesh = GetNode<MeshInstance3D>("MeshInstance3D"); | |
var material = mesh.GetActiveMaterial(0) as StandardMaterial3D; | |
material!.AlbedoTexture = texture; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment