This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I use resources in my rpg-template-project so i want to export a resource, so later people can slot in their own resources.
But to make sure diffrent Objects have unique resources i wanted to use .duplicate() (i have solved that problem with localtoscene so no worries here)

Cause of some bugs i used the debugger and then noticed this behaviour(exampleCode below):

extends Control
export (Resource) var resourceExport
onready var resourceDuplicate = resourceExport.duplicate()

func _ready():
    print(resourceExport)
    print()
    print(resourceDuplicate)
    print(resourceDuplicate.amount)

when i use the debugger i get this result in the editor:
https://ibb.co/Kz1sDM7

as you can see the duplicated resource exists in the debugger and also prints out its own variables, but on the right side in the inspector the resourceDuplicate-Member is empty. Is this expected behaviour?

Godot version 3.2.3
in Engine by (18 points)

1 Answer

0 votes

Try yielding a frame before your break to see if it manages to update? If it still doesn't, you might have found a bug. Check on the git that it was not filed already, and if it was not, add it.

by (2,720 points)

Im not quite sure how to yield a frame.
I tried this:
yield(gettree(), "idleframe")
before and after duplicating the resource in _ready().
i also tried it out to duplicate the resource in _process():
Both times the behaviour didn't change. Was this what you meant or is there
another way to yuild a frame?

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.