Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The C# Interface ISerializationListener is undocumented #10615

Open
Lennart-Bours opened this issue Feb 4, 2025 · 2 comments
Open

The C# Interface ISerializationListener is undocumented #10615

Lennart-Bours opened this issue Feb 4, 2025 · 2 comments

Comments

@Lennart-Bours
Copy link

Your Godot version:

4.3

Issue description:

If you are using C# in your Godot project, you can implement ISerializationListener to execute code in OnBeforeSerialize and OnAfterDeserialize. These functions are called when building the C# solution, and perhaps also in other circumstances?

This feature can be helpful if you have to acount for serialization in your [Tool] scripts, but is completely undocumented. I only found out about its existence via this informative issue: godotengine/godot-proposals#9001

Frankly, it would be helpful if all the information in that issue was added to the documentation. The Godot API for C# section seems like a logical place.

I can attempt to write the documentation, but I'm not particularly knowledgable about the behaviour of ISerializationListener, and even less on the entire process of rebuilding the C# solution.

URL to the documentation page (if already existing):
N/A

@raulsntos
Copy link
Member

The ISerializationListener interface is intentionally undocumented because we don't want to encourage its usage. It likely should have been internal from the beginning.

In the engine code we use it to maintain state across assembly reloads. The process of reloading the .NET assemblies is indeed quite complicated and ideally not something users should need to worry about.

We'll likely change the reloading process in the future and we don't want to limit ourselves to the current ISerializationListener design, we may want to change it.

@Lennart-Bours
Copy link
Author

That there are good reasons to discourage the use of the interface, I can understand. Still, it is strange to me to choose to keep it undocumented. This creates a situation where the intent of the interface is unclear, and doesn't warn a potential user that discovers its existence against using it. Also because it pops up in a number of Issues, see for example also this one: godotengine/godot#90837. And after finding it in these issues, I used it to create a work-around for this issue I encountered: godotengine/godot#102455.

Would it not be clearer to add it to the documentation with the strong warning against relying on it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants