Make A resource unique

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By vonflyhighace2
:warning: Old Version Published before Godot 3 was released.

I notice in the editor there is a make unique option on some of the resources. how would I go about getting that functionality through code?

:bust_in_silhouette: Reply From: GlaDOSik

Resource has a method duplicate(). It returns the copy of the resource.

:bust_in_silhouette: Reply From: Shawk

To expand upon @GlaDOSik’s answer, I’m pretty sure this is exactly what you’d put in the code, res being the path to the resource:

res = res.duplicate()
:bust_in_silhouette: Reply From: zen3001

Very old post, but just for future people googling this.
In the resource parameters enable “Local To Scene”
enter image description here