Spawn of a new object with it's own specific new material

After you spawn an object, it comes with the existing material.

Do you think it’s possible to spawn this object, creating a new material at the same time and setting it for this new object (thus without all spawned objects sharing the same material) ?

I think you could do something like on spawning, set a property for the object which defined which material it used… Although maybe this is a more convoluted way of doing it than what is needed…

@Armored_Blob yes, to do this I already defined a new node I called “Material Named”

Thus the pivot of this discussion is about creating a “new, unique, not already existing Material” dynamically during the play, and then allocate it to the new spawned object.

As you can see, with this kind of “Material Named” node, even if I can allocate a unique material to the new object using a string I set with the good RGB_xx_xx_xx code, the Material needs to be created by hand before.

Thus, having to create all those Materials called RGB_xx_xx_xx before using them for more than +100 objects, it’s laborious :roll_eyes: and its the job of the ordi …

The question is then about a kind of the dynamic creation of unique materials during the play.

(I though for example also about defining a kind of sprite material map and then adjust it over each new object … but seems complicated to realize and then use)

I’m not sure if this topic might help, but it is about controlling material parameters in nodes, not creating new materials in nodes. I know that there is a way to create materials on the fly in Haxe, but I’m pretty sure that there isn’t anything for that in nodes.

1 Like

@zicklag effectively this way of doing with modifying the parameter value isn’t the solution as it’s not allowing us to create a unique material for each new object.

1 Like