mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
Fix C# main screen plugin example and document C# EditorInterface singleton (#9399)
* 🐞 fix(plugins): fix syntax errors Correct the syntax errors in the plugin development section, specifically by modifying 'EditorInterface' to 'EditorInterface.Singleton' in the C# portion. It is imperative to utilize the singleton pattern here to ensure the plugin successfully compiles. * 🐞 fix(different): ADD exceptions Provide explanations for Singleton exceptions of `EditorInterface`
This commit is contained in:
@@ -92,7 +92,7 @@ Add five extra methods such that the script looks like this:
|
||||
|
||||
public override Texture2D _GetPluginIcon()
|
||||
{
|
||||
return EditorInterface.GetEditorTheme().GetIcon("Node", "EditorIcons");
|
||||
return EditorInterface.Singleton.GetEditorTheme().GetIcon("Node", "EditorIcons");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -210,7 +210,7 @@ Here is the full plugin script:
|
||||
{
|
||||
MainPanelInstance = (Control)MainPanel.Instantiate();
|
||||
// Add the main panel to the editor's main viewport.
|
||||
EditorInterface.GetEditorMainScreen().AddChild(MainPanelInstance);
|
||||
EditorInterface.Singleton.GetEditorMainScreen().AddChild(MainPanelInstance);
|
||||
// Hide the main panel. Very much required.
|
||||
_MakeVisible(false);
|
||||
}
|
||||
@@ -244,7 +244,7 @@ Here is the full plugin script:
|
||||
public override Texture2D _GetPluginIcon()
|
||||
{
|
||||
// Must return some kind of Texture for the icon.
|
||||
return EditorInterface.GetEditorTheme().GetIcon("Node", "EditorIcons");
|
||||
return EditorInterface.Singleton.GetEditorTheme().GetIcon("Node", "EditorIcons");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user