Till multiple gameobject with a unique material

Hi everyone

I’m working on a 2D platform game with the particularity that the level is created randomly with a script in C#.

I have a Material that i want to apply to all my gameobject cubes, but depending on the scale of my cubes, the material is more or less ugly :wink:

I know i can till a material to adapt it to one size of cube, and i know how to change it with script, but once i change the till of my Material, it of course changes it for all my gameobject and not only the current one ( i have more or less 200 cubes in my level )

So the question is, is there a way to adapt the till of a material according to the scale of my gameobject without impacting all my gameobjects ?

Of course i still have the solution to make about 30 Materiel with different till settings and thx to the script, use the one that suits the more to my situation, but it will be heavy

If someone knows a way, or a trick to do that, please help :wink:

I don’t don’t understand your use of the word ‘Till’. Did you mean ‘tile’? If so, when you make changes to the material.mainTexureScale at runtime, unity generates a unique material instance (and therefore a change only impacts one object). Here is a another answer with a script you can apply to all your objects that changes the tiling based on the size of the object: