rj-action-library/Runtime/Actions/Visual/SetMaterial.cs

35 lines
552 B
C#
Raw Normal View History

2025-05-27 06:51:48 +00:00
using Godot;
namespace Rokojori
{
[Tool]
[GlobalClass ]
public partial class SetMaterial : Action
{
[Export]
public Node3D target;
[Export]
public Material material;
[Export]
public MaterialSlot slot = MaterialSlot.None;
[Export]
public int index = 0;
protected override void _OnTrigger()
{
if ( target == null || material == null )
{
return;
}
var msc = MaterialSurfaceContainer.From( target, index );
msc.SetMaterialInSlot( slot, material );
}
}
}