|Topic was automatically imported from the old Question2Answer platform.
I am using Godot+Mono and when I try to serialize an InputEvent using C# it crashes upon load or save
E 0:00:13.720 System.Reflection.MemberInfo System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(System.RuntimeType ): System.Runtime.Serialization.SerializationException: Type 'Godot.InputEventKey' in Assembly 'GodotSharp, Version=184.108.40.206, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
Load (error due to corrupted save file when it crashed during saving):
E 0:00:01.157 void System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run(): System.Runtime.Serialization.SerializationException: End of Stream encountered before parsing was completed.
I got around this temporarily by creating my own SerializableInputEvent class that saves the keyboard scancode or the mouseindex and uses them to re-create the input event for input binding. Obviously this is a limited approach that fails on all other input types, defeating the purpose of input binding.
Ideally I’d like to remove this intermediary class, or at least make it work with all possible input events. Would it be possible to somehow convert the Godot.InputEvent to a blob and save that blob directly? I’d imagine this would be required functionality when sending IE’s remotely for multi-player games, but I am having trouble figuring out how to do this. Any help is appreciated.