Changing material from inside Jobs?

Hey everyone,

I was wondering if I can change a transform’s material from inside an IJobParallelForTransform, and if so, how?

Thanks!

A transform doesn’t have a material. You mean the MeshRenderer material property? Regardless, Material is a managed object so it’s a no. What you can do is generate a list of object/material indexes in a job, and afterwards loop over that on the main thread and make the assignments.

You can also look into MaterialPropertyBlocks which may be helpful depending on the reason for changing the material.

1 Like

Thank you. Yeah that’s what I’m doing now. Just wanted to make sure I’m not missing anything :slight_smile: