Getting the material of an object

  • On 10/12/2014 at 07:34, xxxxxxxx wrote:

    Does anyone know of a faster way to get the material of an object that is not on the object itself?

    For example, I have a material on the top null that textures anything that does not have a tag underneath. My current method is going up the hierarchy and testing each material until I find the one that the object is using. I feel like this is a really bad way of doing this and can be slow with hundreds of nulls and materials.

  • On 10/12/2014 at 08:28, xxxxxxxx wrote:


    what do you mean with "testing each material"? You could simply check all parent objects if they have a tag of the type Ttexture. If yes simply access the texture tag to get the material.

    Best wishes,

  • On 10/12/2014 at 09:21, xxxxxxxx wrote:

    Some of the parent objects use a selection tag for the material or multiple materials. If so, then I would be getting the wrong material on some objects. I optimized my code a little so It's in a manageable speed now.

Log in to reply