# Changes the Material of the Mesh used by this instance. Optionally can specify which Mesh element index to apply the material to, otherwise defaults to the 0 (default) Mesh element
SetMaterial<native><public>(Material:material, ?Index:int = external {})<transacts>:void
How is possible to declare a material? This does not work:
Hey! So what you need to do is expose the asset for the material, you unfortunately can’t just make it an editable field. Fortunately, exposing the material is pretty straightforward? Here’s the documentation that made things click for me: Exposing Assets
The TLDR is that you need to call the file path of the material directly to access it in scripts. Below is what a proper call looks like, from a project I’ve been working on:
CreativeProp.SetMaterial(Materials.InvisibleMat)
“Materials” is a folder in my Content Folder, and “InvisibleMat” is the filename of the material I’m setting. As long as the code can detect the material is there, that’s all you need to do! Hopefully this helps!