Godot: Shader Material is not unique

Created on 23 Jun 2015  Â·  4Comments  Â·  Source: godotengine/godot

when I duplicate a sprite that has a shader and change the params of shader in one of them , both of them will change, I am instancing this sprite , and I need to change everyone of them separately how can I achieve that? can I make the materials unique in the code?

archived

Most helpful comment

If you want to make the material unique by code, in case you want to change
parameters, just do:

sprite.set_material( sprite.get_material().duplicate() )

On Wed, Jun 24, 2015 at 9:22 AM, Mohammad Hadi Aliakbar <
[email protected]> wrote:

yeah I wrote load it then I duplicate it with value false, in this way
everyone of them is unique.

On 23 June 2015 at 18:33, ilearain [email protected] wrote:

Ahh.. In code? I have never tried it [image: :laughing:]

—
Reply to this email directly or view it on GitHub
<https://github.com/okamstudio/godot/issues/2162#issuecomment-114517007
.

—
Reply to this email directly or view it on GitHub
https://github.com/okamstudio/godot/issues/2162#issuecomment-114849031.

All 4 comments

In right/upper of property editor, Click on the settings icon in the inspector (it looks like a gear icon). Select "Make Resources Unique."

2054

Ahh.. In code? I have never tried it :laughing:

yeah I wrote load it then I duplicate it with value false, in this way
everyone of them is unique.

On 23 June 2015 at 18:33, ilearain [email protected] wrote:

Ahh.. In code? I have never tried it [image: :laughing:]

—
Reply to this email directly or view it on GitHub
https://github.com/okamstudio/godot/issues/2162#issuecomment-114517007.

If you want to make the material unique by code, in case you want to change
parameters, just do:

sprite.set_material( sprite.get_material().duplicate() )

On Wed, Jun 24, 2015 at 9:22 AM, Mohammad Hadi Aliakbar <
[email protected]> wrote:

yeah I wrote load it then I duplicate it with value false, in this way
everyone of them is unique.

On 23 June 2015 at 18:33, ilearain [email protected] wrote:

Ahh.. In code? I have never tried it [image: :laughing:]

—
Reply to this email directly or view it on GitHub
<https://github.com/okamstudio/godot/issues/2162#issuecomment-114517007
.

—
Reply to this email directly or view it on GitHub
https://github.com/okamstudio/godot/issues/2162#issuecomment-114849031.

Was this page helpful?
0 / 5 - 0 ratings