Skip to content
This repository was archived by the owner on Sep 26, 2024. It is now read-only.

Commit a1b5af8

Browse files
Make use of _EnablePlugin _DisablePlugin
1 parent 60eccbf commit a1b5af8

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

addons/visualize/Scripts/Visualize.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,29 @@ public partial class Visualize : EditorPlugin
99
private const string PLUGIN = "Visualize";
1010
private const string AUTOLOAD = "VisualizeAutoload";
1111

12-
public override void _EnterTree()
13-
{
12+
public override void _EnablePlugin()
13+
{
1414
CSharpScript autoloadScript = GD.Load<CSharpScript>($"res://addons/{PLUGIN.ToLower()}/Scripts/{AUTOLOAD}.cs");
1515

1616
if (!ProjectSettings.HasSetting("autoload/" + AUTOLOAD))
1717
{
1818
ProjectSettings.SetSetting("autoload/" + AUTOLOAD, autoloadScript.ResourcePath);
1919
Error error = ProjectSettings.Save();
20-
20+
GD.Print("Enabled plugin");
2121
if (error != Error.Ok)
2222
{
2323
GD.PushWarning($"Failed to save project settings when entering {PLUGIN} plugin");
2424
}
2525
}
2626
}
2727

28-
public override void _ExitTree()
29-
{
28+
public override void _DisablePlugin()
29+
{
3030
if (ProjectSettings.HasSetting("autoload/" + AUTOLOAD))
3131
{
3232
ProjectSettings.Clear("autoload/" + AUTOLOAD);
3333
Error error = ProjectSettings.Save();
34-
34+
GD.Print("Disabled plugin");
3535
if (error != Error.Ok)
3636
{
3737
GD.PushWarning($"Failed to save project settings when exiting {PLUGIN} plugin");

project.godot

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ project/assembly_name="Visualize"
2626
[editor_plugins]
2727

2828
enabled=PackedStringArray("res://addons/visualize/plugin.cfg")
29+
30+
[plugin]
31+
32+
visualize/enabled=true

0 commit comments

Comments
 (0)