diff --git a/Source/Editor/Cooker/Steps/CookAssetsStep.cpp b/Source/Editor/Cooker/Steps/CookAssetsStep.cpp index eb0ddb612..7e7a2ca81 100644 --- a/Source/Editor/Cooker/Steps/CookAssetsStep.cpp +++ b/Source/Editor/Cooker/Steps/CookAssetsStep.cpp @@ -1040,6 +1040,8 @@ bool CookAssetsStep::Perform(CookingData& data) auto minDateTime = DateTime::MinValue(); #endif int32 subStepIndex = 0; + AssetReference assetRef; + assetRef.Unload.Bind([]() { LOG(Error, "Asset gets unloaded while cooking it!"); Platform::Sleep(100); }); for (auto i = data.Assets.Begin(); i.IsNotEnd(); ++i) { BUILD_STEP_CANCEL_CHECK; @@ -1097,16 +1099,16 @@ bool CookAssetsStep::Perform(CookingData& data) } // Load asset (and keep ref) - AssetReference ref = Content::LoadAsync(assetId); - if (ref == nullptr) + assetRef = Content::LoadAsync(assetId); + if (assetRef == nullptr) { data.Error(TEXT("Failed to load asset included in build.")); return true; } - e.Info.TypeName = ref->GetTypeName(); + e.Info.TypeName = assetRef->GetTypeName(); // Cook asset - if (Process(data, cache, ref.Get())) + if (Process(data, cache, assetRef.Get())) return true; data.Stats.CookedAssets++; diff --git a/Source/Editor/GUI/Docking/DockHintWindow.cs b/Source/Editor/GUI/Docking/DockHintWindow.cs index de5b39c2d..0fdc6648c 100644 --- a/Source/Editor/GUI/Docking/DockHintWindow.cs +++ b/Source/Editor/GUI/Docking/DockHintWindow.cs @@ -100,7 +100,9 @@ namespace FlaxEditor.GUI.Docking // Check if window won't be docked if (_toSet == DockState.Float) { - var window = _toMove.Window.Window; + var window = _toMove.Window?.Window; + if (window == null) + return; Vector2 mouse = FlaxEngine.Input.MouseScreenPosition; // Move base window diff --git a/Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs b/Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs index 006e8850b..0d74bb5e9 100644 --- a/Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs +++ b/Source/Tools/Flax.Build/Platforms/Unix/UnixToolchain.cs @@ -181,7 +181,7 @@ namespace Flax.Build.Platforms case TargetArchitecture.ARM64: return "aarch64-unknown-linux-gnueabi"; default: throw new InvalidArchitectureException(architecture); } - case TargetPlatform.PS4: return "orbis"; + case TargetPlatform.PS4: return (string)Utilities.GetStaticValue("Flax.Build.Platforms.PS4Toolchain", "ToolchainName"); case TargetPlatform.Android: switch (architecture) { diff --git a/Source/Tools/Flax.Build/Utilities/Utilities.cs b/Source/Tools/Flax.Build/Utilities/Utilities.cs index e08755175..a59feb025 100644 --- a/Source/Tools/Flax.Build/Utilities/Utilities.cs +++ b/Source/Tools/Flax.Build/Utilities/Utilities.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; +using System.Reflection; using System.Text; namespace Flax.Build @@ -43,6 +44,23 @@ namespace Flax.Build return Enumerable.Empty() as T[]; } + /// + /// Gets the static field value from a given type. + /// + /// Name of the type. + /// Name of the field. + /// The field value. + public static object GetStaticValue(string typeName, string fieldName) + { + var type = Type.GetType(typeName); + if (type == null) + throw new Exception($"Cannot find type \'{typeName}\'."); + var field = type.GetField(fieldName, BindingFlags.Public | BindingFlags.Static); + if (field == null) + throw new Exception($"Cannot find static public field \'{fieldName}\' in \'{typeName}\'."); + return field.GetValue(null); + } + /// /// Gets the size of the file as a readable string. ///