Fix Game Cooker wait on code compile/load end before cooking starts
#4277
This commit is contained in:
@@ -304,7 +304,7 @@ namespace FlaxEditor.Modules
|
||||
//
|
||||
_toolStripBuildScenes.Enabled = (canEditScene && !isPlayMode) || Editor.StateMachine.BuildingScenesState.IsActive;
|
||||
_toolStripBuildScenes.Visible = Editor.Options.Options.General.BuildActions?.Length != 0;
|
||||
_toolStripCook.Enabled = Editor.Windows.GameCookerWin.CanBuild(Platform.PlatformType) && !GameCooker.IsRunning;
|
||||
_toolStripCook.Enabled = Editor.Windows.GameCookerWin.CanBuild(Platform.PlatformType) && Editor.Windows.GameCookerWin.CanCook();
|
||||
//
|
||||
var play = _toolStripPlay;
|
||||
var pause = _toolStripPause;
|
||||
|
||||
@@ -33,6 +33,9 @@ namespace FlaxEditor.States
|
||||
/// <inheritdoc />
|
||||
public override bool CanReloadScripts => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool CanCookGame => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string Status => AutoSaveStatus;
|
||||
|
||||
|
||||
@@ -48,15 +48,20 @@ namespace FlaxEditor.States
|
||||
public virtual bool CanChangeScene => false;
|
||||
|
||||
/// <summary>
|
||||
/// Checks if can enter play mode in this state.
|
||||
/// Checks if can start play mode in this state.
|
||||
/// </summary>
|
||||
public virtual bool CanEnterPlayMode => false;
|
||||
|
||||
/// <summary>
|
||||
/// Checks if can enter recompile scripts in this state.
|
||||
/// Checks if can recompile scripts in this state.
|
||||
/// </summary>
|
||||
public virtual bool CanReloadScripts => false;
|
||||
|
||||
/// <summary>
|
||||
/// Checks if can cook game in this state.
|
||||
/// </summary>
|
||||
public virtual bool CanCookGame => false;
|
||||
|
||||
/// <summary>
|
||||
/// Checks if static is valid for Editor UI calls and other stuff.
|
||||
/// </summary>
|
||||
|
||||
@@ -37,6 +37,9 @@ namespace FlaxEditor.States
|
||||
/// <inheritdoc />
|
||||
public override bool CanEnterPlayMode => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool CanCookGame => true;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when play mode is starting (before scene duplicating).
|
||||
/// </summary>
|
||||
|
||||
@@ -927,6 +927,15 @@ namespace FlaxEditor.Windows
|
||||
_exitOnBuildEnd = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if can cook game now (based on editor state).
|
||||
/// </summary>
|
||||
/// <returns>True if can cook, otherwise false.</returns>
|
||||
public bool CanCook()
|
||||
{
|
||||
return !GameCooker.IsRunning && Editor.StateMachine.CurrentState.CanCookGame;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if can build for the given platform (both supported and available).
|
||||
/// </summary>
|
||||
@@ -1290,7 +1299,7 @@ namespace FlaxEditor.Windows
|
||||
public override void OnUpdate()
|
||||
{
|
||||
// Building queue
|
||||
if (!GameCooker.IsRunning)
|
||||
if (CanCook())
|
||||
{
|
||||
if (_buildingQueue.Count > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user