Change material in other scene

Hi all, I need your help with this problem.

I want to change a material of an object in an other scene, for example: when you click the button in scene 1 it will change the material of an object in scene 2.

I have searched for some more information on the web, and I saw that you can do this with among other things like DontDestroyOnLoad(), but I do not know how to apply this to what I want.

I’m a beginner in C# and Unity so I like to have some code, because my experience are not the best with c#.

Thanks all!

This doesn’t depend on the scene your material is used in.
Just create a

public Material _material;

in your script, assign the particular material in the Inspector, and change its properties via code.

If multiple objects are using the same material and you only want to change it for one particular object, you might have to duplicate the material and use the duplicated one on your desired object (and modify this one via code).