Hello.
I’m building a plugin system by safely compiling external code and then using reflection once to get methods and do proper processing. There is an issue however. I need to transfer an amount of data between main game and the externally loaded code. This doesn’t appear to be a problem for Vector3 or byte[ ] because both game and the external code has access to Unity and System namespaces, but what if I want to add my own struct to communicate between them both? I could of course include the struct on both sides and then serialize them to byte[ ] and string but that is a heavy performance hit. Let say that external code requests player data, and the player data struct looks as follows:
public struct PlayerData {
public int id;
public string nickname;
public Color flagcolor
}
How do I make sure that I as game programmer and hypothetical modder have access to the same struct that is easily transferable between game and plugin precisely same as Vector3 or Color?
ps: No, I cannot just create Action<int, string, Color>
because this would become nightmare to maintain later on.