The problem is that you don’t initialize the property private Material material;
When you create object like that you create a reference that points to null
. In your code you are trying to modify this object but since it’s not initialized it’s null
. The solution is to initialize it in the constructor like so:
public FlowLines()
{
this.material = new Material();
}
2
solved The variable has not been assigned [duplicate]