Add **Web platform with Emscripten**

This commit is contained in:
Wojtek Figat
2026-02-14 00:07:21 +01:00
parent fd0584b406
commit f12ad5c874
80 changed files with 1529 additions and 61 deletions

View File

@@ -95,6 +95,8 @@ IMPLEMENT_ENGINE_SETTINGS_GETTER(SwitchPlatformSettings, SwitchPlatform);
IMPLEMENT_ENGINE_SETTINGS_GETTER(MacPlatformSettings, MacPlatform);
#elif PLATFORM_IOS
IMPLEMENT_ENGINE_SETTINGS_GETTER(iOSPlatformSettings, iOSPlatform);
#elif PLATFORM_WEB
IMPLEMENT_ENGINE_SETTINGS_GETTER(WebPlatformSettings, WebPlatform);
#else
#error Unknown platform
#endif
@@ -280,6 +282,7 @@ void GameSettings::Deserialize(DeserializeStream& stream, ISerializeModifier* mo
DESERIALIZE(PS5Platform);
DESERIALIZE(MacPlatform);
DESERIALIZE(iOSPlatform);
DESERIALIZE(WebPlatform);
}
#if USE_EDITOR

View File

@@ -210,6 +210,14 @@ namespace FlaxEditor.Content.Settings
public JsonAsset iOSPlatform;
#endif
#if FLAX_EDITOR || PLATFORM_WEB
/// <summary>
/// Reference to <see cref="WebPlatformSettings"/> asset. Used to apply configuration on Web platform.
/// </summary>
[EditorOrder(2110), EditorDisplay("Platform Settings", "Web"), AssetReference(typeof(WebPlatformSettings), true), Tooltip("Reference to Web Platform Settings asset")]
public JsonAsset WebPlatform;
#endif
/// <summary>
/// Gets the absolute path to the game settings asset file.
/// </summary>
@@ -345,6 +353,10 @@ namespace FlaxEditor.Content.Settings
if (type == typeof(iOSPlatformSettings))
return Load<iOSPlatformSettings>(gameSettings.iOSPlatform) as T;
#endif
#if FLAX_EDITOR || PLATFORM_WEB
if (type == typeof(WebPlatformSettings))
return Load<WebPlatformSettings>(gameSettings.WebPlatform) as T;
#endif
if (gameSettings.CustomSettings != null)
{
@@ -443,6 +455,10 @@ namespace FlaxEditor.Content.Settings
if (type == typeof(iOSPlatformSettings))
return gameSettings.iOSPlatform;
#endif
#if FLAX_EDITOR || PLATFORM_WEB
if (type == typeof(WebPlatformSettings))
return gameSettings.WebPlatform;
#endif
if (gameSettings.CustomSettings != null)
{
@@ -557,6 +573,8 @@ namespace FlaxEditor.Content.Settings
return SaveAsset(gameSettings, ref gameSettings.MacPlatform, obj);
if (type == typeof(iOSPlatformSettings))
return SaveAsset(gameSettings, ref gameSettings.iOSPlatform, obj);
if (type == typeof(WebPlatformSettings))
return SaveAsset(gameSettings, ref gameSettings.WebPlatform, obj);
return true;
}

View File

@@ -90,6 +90,7 @@ public:
Guid PS5Platform;
Guid MacPlatform;
Guid iOSPlatform;
Guid WebPlatform;
public:
/// <summary>

View File

@@ -38,3 +38,6 @@
#if PLATFORM_IOS
#include "Engine/Platform/iOS/iOSPlatformSettings.h"
#endif
#if PLATFORM_WEB
#include "Engine/Platform/Web/WebPlatformSettings.h"
#endif