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

🐞 fix(plugins): fix syntax errors #9399

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

easterNday
Copy link

@easterNday easterNday commented May 19, 2024

Correct the syntax errors in the plugin development section, specifically by modifying EditorInterface to EditorInterface.Singleton in the C# portion. It is imperative to utilise the singleton pattern here to ensure the plugin successfully compiles.

Correct the syntax errors in the plugin development section, specifically by modifying 'EditorInterface' to 'EditorInterface.Singleton' in the C# portion. It is imperative to utilise the singleton pattern here to ensure the plugin successfully compiles.
@AThousandShips
Copy link
Member

Are you sure this is needed? See here

@AThousandShips AThousandShips requested a review from a team May 19, 2024 14:52
@AThousandShips AThousandShips added topic:dotnet area:manual Issues and PRs related to the Manual/Tutorials section of the documentation topic:plugin labels May 19, 2024
@easterNday
Copy link
Author

easterNday commented May 19, 2024

The EditorInterface isn't a static class, and in the course of developing plugins for Godot's main screen, it's essential to utilise the singleton instance of EditorInterface; I fancy this to be a prerequisite. Indeed, attempts to proceed without incorporating this singleton would meet with compilation obstacles, rendering the process unfeasible.
image
image

@paulloz
Copy link
Member

paulloz commented May 19, 2024

Are you sure this is needed?

Yes, it is totally needed 🙂

@AThousandShips
Copy link
Member

Then this singleton is an exception, should probably be added to the documentation

Provide explanations for Singleton exceptions of `EditorInterface`
@easterNday
Copy link
Author

I'm not entirely sure if this fully meets your requirements, but I have added a specific exception explanation to that section.

@paulloz
Copy link
Member

paulloz commented May 19, 2024

I think if we want to make a table listing everywhere .Singleton is necessary, we should do it exhaustively (could be done in its own PR). IMHO, an incomplete list is as bad as the current status quo.
FWIW, examples in the class reference are already up-to-date. E.g.

return EditorInterface.Singleton.GetEditorTheme().GetIcon("Node", "EditorIcons");

@easterNday
Copy link
Author

I think if we want to make a table listing everywhere .Singleton is necessary, we should do it exhaustively (could be done in its own PR). IMHO, an incomplete list is as bad as the current status quo.

You're right, I will follow your advice and complete this list accordingly.

@raulsntos
Copy link
Member

EditorInterface is the only one:

https://github.com/godotengine/godot/blob/daa81bbb7d1c6d75d1711595604178ee62a5801d/modules/mono/editor/bindings_generator.cpp#L4801-L4803

This is because historically this class wasn't registered as a singleton, so when it became one in godotengine/godot#75694 we couldn't make it static without breaking compat.

All the other singletons are static classes, although they also have a Singleton property. In this case using the static class or the instance makes no difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:manual Issues and PRs related to the Manual/Tutorials section of the documentation topic:dotnet topic:plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants