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 am trying to export a dictionary of enum: float. In the editor my enum shows up as an int, instead of a string. This makes it difficult to use. There is also no auto-complete available. If possible these would be great features to have.
Steps to reproduce:
[Export]
public Godot.Collections.Dictionary Weights = new Godot.Collections.Dictionary() {
{EnumName1, 0.5}
};
Appears as the following in the editor
If you type the dictionary, it will correctly set the value as a float (otherwise initializing to 1 will cause it to be an int in the editor), but the enum is still not auto-translated to a string in the editor.
[Export]
public Godot.Collections.Dictionary<ClassName.EnumNames, float> Weights = new Godot.Collections.Dictionary<ClassName.EnumNames, float> () {
{ EnumName1, 1 } // 1 will be a float in the editor, but EnumName1 will still show up as 11 and not offer auto-complete
};
Using a C# dictionary causes the exported var to not show up at all in the editor.
The text was updated successfully, but these errors were encountered:
In the editor my enum shows up as an int, instead of a string. [...] There is also no auto-complete available.
Without typing information the editor can't know that your values represent an enum. The editor receives a value of the underlying type, which means an integral type.
IntelliSense also can't know what is the type of the keys or the values of the Dictionary without the typing information, since you are using the non-generic Godot.Collections.Dictionary the typing information is not available.
If you use the generic Godot.Collections.Dictionary<TKey, TValue> the typing information is available and IntelliSense can help you when using the dictionary keys/values, this information needs to be passed to the editor but currently this is not supported.
For the typing information to be supported in the editor we'd need to implement type hints for dictionaries, there is already a proposal for this: godotengine/godot-proposals#56.
Godot version:
3.1.1
OS/device including version:
Win10
Issue description:
Feature request:
I am trying to export a dictionary of
enum: float
. In the editor my enum shows up as an int, instead of a string. This makes it difficult to use. There is also no auto-complete available. If possible these would be great features to have.Steps to reproduce:
Appears as the following in the editor
If you type the dictionary, it will correctly set the value as a float (otherwise initializing to 1 will cause it to be an int in the editor), but the enum is still not auto-translated to a string in the editor.
Using a C# dictionary causes the exported var to not show up at all in the editor.
The text was updated successfully, but these errors were encountered: