thank you very much for this solution, i found another solution to my problem, the fix for my code was to add the & operator to this:
before:
UMaterialEditorOnlyData& Data = *UsedMaterial->GetEditorOnlyData();
FMaterialExpressionCollection MyExpressions = Data.ExpressionCollection;
after:
UMaterialEditorOnlyData& Data = *UsedMaterial->GetEditorOnlyData();
FMaterialExpressionCollection& MyExpressions = Data.ExpressionCollection; //Added here the & operator
then i was able to add all expression to my material using “MyExpressions” like this:
MyExpressions.AddExpression(/*UMaterialExpression HERE*/);
it worked.
i think your solution is better so i’ll mark your message as solution!
thank you again!