This commit is contained in:
2021-10-05 15:58:45 +02:00
parent 590c75f4cb
commit 77f2bd5115
4 changed files with 28 additions and 6 deletions
@@ -1040,6 +1040,8 @@ bool CookAssetsStep::Perform(CookingData& data)
auto minDateTime = DateTime::MinValue();
#endif
int32 subStepIndex = 0;
AssetReference<Asset> 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<Asset> ref = Content::LoadAsync<Asset>(assetId);
if (ref == nullptr)
assetRef = Content::LoadAsync<Asset>(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++;
+3 -1
View File
@@ -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
@@ -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)
{
@@ -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<T>() as T[];
}
/// <summary>
/// Gets the static field value from a given type.
/// </summary>
/// <param name="typeName">Name of the type.</param>
/// <param name="fieldName">Name of the field.</param>
/// <returns>The field value.</returns>
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);
}
/// <summary>
/// Gets the size of the file as a readable string.
/// </summary>