Play button in editor
This commit is contained in:
parent
ad56c6f61f
commit
285b90f503
6 changed files with 38 additions and 5 deletions
|
|
@ -55,11 +55,21 @@ public partial class AdventureEditor : MarginContainer
|
|||
HardReload();
|
||||
}
|
||||
}
|
||||
public override void _ExitTree()
|
||||
{
|
||||
EditorInterface.Singleton.GetInspector().PropertyEdited -= OnInspectorPropertyChanged;
|
||||
public void Play()
|
||||
{
|
||||
var player = new AdventurePlayer();
|
||||
var packed = new PackedScene();
|
||||
player.pathToLevel = editedPath;
|
||||
packed.Pack(player);
|
||||
ResourceSaver.Save(packed, "res://addons/pvzadventure/cache/player.tscn");
|
||||
EditorInterface.Singleton.PlayCustomScene("res://addons/pvzadventure/cache/player.tscn");
|
||||
}
|
||||
public override void _ExitTree()
|
||||
{
|
||||
EditorInterface.Singleton.GetInspector().PropertyEdited -= OnInspectorPropertyChanged;
|
||||
EditorInterface.Singleton.GetInspector().EditedObjectChanged -= OnResourceChanged;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue