The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

+3 votes

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?

in Engine by (274 points)

3 Answers

+3 votes

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

by (836 points)
+1 vote

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()
by (38 points)
+8 votes

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

by (307 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.