Programmatically set Static Material Variable

Hello

I have a class that has a static variable of type Material. I am trying to initialise/set the value for that static variable but it doesn’t seem to be working, ie, the Material never has the correct material(it just looks like a pink rectangle).

How do I set the value of a Material programmatically(not using the inpector)?

I have the following Materials inside the folder “MyProject/Assets/Materials/” called BrickBreakable, BrickSolid, BrickItem.

class BrickItem : MonoBehaviour {
        public static Material breakableMaterial  = new Material("BrickBreakable"); // always looks pink when it shoudld be a brick colour
	public static Material solidMaterial	  = new Material("BrickSolid");
	public static Material itemMaterial 	  = new Material("BrickItem");

        void Start() {
             if (state == State.BRICK_BREAKABLE)
                 material = breakableMaterial;
        }

First of all u can not declare and assign its value outside of function. (“public static Material breakableMaterial = new Material(“BrickBreakable”)”). This will give u an error. What do u want to do, creating a new material and try to apply already existed material to an object. Please elaborate.