Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Allow MultiLineNode.Material setter to change in runtime
#2
FYI, I inherit my own class from MultiLineNode and added Wash and Paint methods that make the trick:

private readonly LineMaterial originalMaterial;
private static readonly PropertyInfo? MaterialProperty = typeof(LineBaseNode).GetProperty(nameof(DimensionLineMeshNode.Material), BindingFlags.Public | BindingFlags.Instance);

public void Paint(LineMaterial mat) => DimensionLineMeshNode.MaterialProperty?.SetValue(this, mat);
public void Wash() => DimensionLineMeshNode.MaterialProperty?.SetValue(this, this.originalMaterial);


public DimensionLineMeshNode(string name, Vector3[] positions, LineMaterial sharedMaterial)
    : base(name)
{
    this.originalMaterial = sharedMaterial;
    this.IsHitTestVisible = true;
    this.Material = sharedMaterial;
    this.Positions = positions;
}
  


Messages In This Thread
RE: Allow MultiLineNode.Material setter to change in runtime - by BiMMate - 03-04-2026, 02:02 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)