You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to implement some sort of duplication mechanism with Python instances in order to use temporary results without altering my initial instance. My problem is that I can't find a way to either return a new instance from Python to Godot, or to pass an instance created in Godot to Python.
For the first option, returning a new instance from Python doesn't seem accepted by Godot:
# script.gdvarMyClass=preload("res://.../MyClass.py")
varinstance=MyClass.new()
varinstance2=instance.duplicate() # -> instance2 is Null !
For the second option, I tried to pass a new instance created in the GDScript to copy the fields in the Python class directly, but I don't get the right class and I didn't find how to retrieve the Python instance:
# MyClass.py@exposedclassMyClass(Object):
# [...]defcopy(self, initial) ->None:
# initial is a <godot.builtins.Object> and not a <MyClass> object, I can't access the attributes
Does somebody known how to overcome these issues?
I'm using Godot 3.5.1_stable and PythonScript 0.5.
Thanks !
The text was updated successfully, but these errors were encountered:
Hello,
I'm trying to implement some sort of duplication mechanism with Python instances in order to use temporary results without altering my initial instance. My problem is that I can't find a way to either return a new instance from Python to Godot, or to pass an instance created in Godot to Python.
For the first option, returning a new instance from Python doesn't seem accepted by Godot:
For the second option, I tried to pass a new instance created in the GDScript to copy the fields in the Python class directly, but I don't get the right class and I didn't find how to retrieve the Python instance:
Does somebody known how to overcome these issues?
I'm using Godot 3.5.1_stable and PythonScript 0.5.
Thanks !
The text was updated successfully, but these errors were encountered: