Skip to content

Instantly share code, notes, and snippets.

@spaceyjase
Last active March 17, 2023 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spaceyjase/828900f4c9c3f714514c5a16364ca277 to your computer and use it in GitHub Desktop.
Save spaceyjase/828900f4c9c3f714514c5a16364ca277 to your computer and use it in GitHub Desktop.
Assign a texture to Albedo in Godot 4
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