Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Setting the albedo property of a material

I’m just trying to set the color of a material at runtime. The C# docs aren’t great.

MaterialOverride.Set("albedo_color", new Color(1f, 1f, 1f));

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

That should be (tested):

((SpatialMaterial)MaterialOverride).AlbedoColor = new Color(1f, 1f, 1f);

You would get NullReferenceException if you let SpatialMaterial initialized. You would get a InvalidCastException if it isn’t a SpatialMaterial (it could be ShaderMaterial).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading