Skip to content

Can't set property for Native Script from Property Editor #25

@sergeykurson

Description

@sergeykurson

After I've set a new value for registered property in Property Editor, I tried to read this value from GDScript.

var simpleclass = load("res://simple.gdns").new()
func _ready():
	print(simpleclass._count);

But received value setted in code (or random value if no initialisation in C++ code).
This is code for registering: register_property("_count", &SimpleClass::_count, int(0));
After some research, I found that addresses for my class object are different when setting from Editor and from GDScript. For example:
Value from _wrapped_setter using Editor: 90942992
Value from _wrapped_getter using GDScript: 90966512
Then I added a log to a constructor and found that my class was created 2 times. So I think this is the root of the problem. To be honestly, I don't know is it a bug or am I doing something wrong :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions