godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.5k stars 20.26k forks source link

Instances of inner class can't be load back with ConfigFile #10189

Open Geequlim opened 7 years ago

Geequlim commented 7 years ago

Operating system or device - Godot version: Godot 3.0 alpha1 on Windows 10

Issue description:

There is a class named MyClass.gd. Instance of this class can be save and load back with ConfigFile but something wrong with the member subObj which is an Instance of the inner class SubClass.

var name = "boy"
var age = 2
var subObj = SubClass.new()

class SubClass:
    var sex = "male"

Steps to reproduce:

  1. Download the project below
  2. Click "Save" button to save an instance of MyClass with ConfigFile
  3. Click "Load" button to load the saved instance back from the saved file.

Link to minimal example project: ConfigFileBug.zip

bojidar-bg commented 7 years ago

Related to #6533?

Geequlim commented 7 years ago

In fact the ConfigFile doesn't requires the GDScript module. So it would be better if inst2dict and dict2inst could be seprated from GDScript language and make them virtual with different script languages.


Edited

If the inst2dict and dict2inst become a common used functions then we can use them to serialize/unserialize script instances everywhere in the same way.

Calinou commented 4 years ago

@Geequlim Can you still reproduce this bug in Godot 3.2.1 or 3.2.2beta4?

akien-mga commented 4 years ago

Still reproducible in 3.2.3 RC 1.