Defold Crashing when changing material on a sprite

Error code -10 means RESOURCE_NOT_FOUND. In this case, I’m guessing rainbow.materialc isn’t referenced anywhere so it’s not included in the build. The simplest way to fix that is to use go.property() with resource.material():

go.property("material1", resource.material("/assets/rainbow/rainbow.materialc"))

It should be throwing a proper error message instead of crashing the engine though :thinking:

4 Likes