diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml
index 45242d98e5..27782be9e4 100644
--- a/.github/workflows/build-android.yml
+++ b/.github/workflows/build-android.yml
@@ -33,6 +33,10 @@ on:
default: Debug
type: string
+concurrency:
+ group: build-android-${{ github.event.pull_request.number || github.ref }}-${{ github.event.inputs.build-type || inputs.build-type || 'Debug' }}
+ cancel-in-progress: true
+
jobs:
#
# Build Stride Runtime for Android
diff --git a/.github/workflows/build-assembly-processor.yml b/.github/workflows/build-assembly-processor.yml
index 9a00e4194e..6eda02accf 100644
--- a/.github/workflows/build-assembly-processor.yml
+++ b/.github/workflows/build-assembly-processor.yml
@@ -29,6 +29,10 @@ on:
default: Debug
type: string
+concurrency:
+ group: build-assembly-processor-${{ github.event.pull_request.number || github.ref }}-${{ github.event.inputs.build-type || inputs.build-type || 'Debug' }}
+ cancel-in-progress: true
+
jobs:
#
# Build Assembly Processor
diff --git a/.github/workflows/build-ios.yml b/.github/workflows/build-ios.yml
index 9ada33e0a1..7a713efef6 100644
--- a/.github/workflows/build-ios.yml
+++ b/.github/workflows/build-ios.yml
@@ -33,6 +33,10 @@ on:
default: Debug
type: string
+concurrency:
+ group: build-ios-${{ github.event.pull_request.number || github.ref }}-${{ github.event.inputs.build-type || inputs.build-type || 'Debug' }}
+ cancel-in-progress: true
+
jobs:
#
# Build Stride Runtime for iOS
diff --git a/.github/workflows/build-launcher.yml b/.github/workflows/build-launcher.yml
index bcced9d613..11258e4aa2 100644
--- a/.github/workflows/build-launcher.yml
+++ b/.github/workflows/build-launcher.yml
@@ -31,6 +31,10 @@ on:
default: Debug
type: string
+concurrency:
+ group: build-launcher-${{ github.event.pull_request.number || github.ref }}-${{ github.event.inputs.build-type || inputs.build-type || 'Debug' }}
+ cancel-in-progress: true
+
jobs:
#
# Build Stride Runtime for Windows
diff --git a/.github/workflows/build-linux-runtime.yml b/.github/workflows/build-linux-runtime.yml
index 531768b08f..baea1644d8 100644
--- a/.github/workflows/build-linux-runtime.yml
+++ b/.github/workflows/build-linux-runtime.yml
@@ -43,6 +43,10 @@ on:
default: OpenGL
type: string
+concurrency:
+ group: build-linux-runtime-${{ github.event.pull_request.number || github.ref }}-${{ github.event.inputs.build-type || inputs.build-type || 'Debug' }}-${{ github.event.inputs.graphics-api || inputs.graphics-api || 'OpenGL' }}
+ cancel-in-progress: true
+
jobs:
#
# Build Stride Runtime for Linux
diff --git a/.github/workflows/build-vs-package.yml b/.github/workflows/build-vs-package.yml
index f89b051ad0..03427c189f 100644
--- a/.github/workflows/build-vs-package.yml
+++ b/.github/workflows/build-vs-package.yml
@@ -28,6 +28,10 @@ on:
default: Debug
type: string
+concurrency:
+ group: build-vs-package-${{ github.event.pull_request.number || github.ref }}-${{ github.event.inputs.build-type || inputs.build-type || 'Debug' }}
+ cancel-in-progress: true
+
jobs:
#
# Build Visual Studio Package
diff --git a/.github/workflows/build-windows-full.yml b/.github/workflows/build-windows-full.yml
index c1f6ce681e..d18fc15037 100644
--- a/.github/workflows/build-windows-full.yml
+++ b/.github/workflows/build-windows-full.yml
@@ -28,6 +28,10 @@ on:
default: Debug
type: string
+concurrency:
+ group: build-windows-full-${{ github.event.pull_request.number || github.ref }}-${{ github.event.inputs.build-type || inputs.build-type || 'Debug' }}
+ cancel-in-progress: true
+
jobs:
#
# Build Stride for Windows
diff --git a/.github/workflows/build-windows-runtime.yml b/.github/workflows/build-windows-runtime.yml
index 6d0ded05a7..60008aef7f 100644
--- a/.github/workflows/build-windows-runtime.yml
+++ b/.github/workflows/build-windows-runtime.yml
@@ -46,6 +46,10 @@ on:
default: Direct3D11
type: string
+concurrency:
+ group: build-windows-runtime-${{ github.event.pull_request.number || github.ref }}-${{ github.event.inputs.build-type || inputs.build-type || 'Debug' }}-${{ github.event.inputs.graphics-api || inputs.graphics-api || 'Direct3D11' }}
+ cancel-in-progress: true
+
jobs:
#
# Build Stride Runtime for Windows
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 35813c2aba..f940f82411 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -16,6 +16,10 @@ on:
- '!crowdin.yml'
workflow_dispatch:
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
jobs:
### Misc. ###
Assembly-Processor:
diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml
index 551819bcce..2124c3af7a 100644
--- a/.github/workflows/test-linux.yml
+++ b/.github/workflows/test-linux.yml
@@ -26,13 +26,17 @@ on:
default: Simple
type: string
+concurrency:
+ group: test-linux-${{ github.event.pull_request.number || github.ref }}-${{ github.event.inputs.build-type || inputs.build-type || 'Debug' }}-${{ github.event.inputs.test-category || inputs.test-category || 'Simple' }}
+ cancel-in-progress: true
+
jobs:
#
# Test Stride on Linux
#
Linux-Tests:
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call' || github.event.pull_request.draft == false }}
- name: Test (${{ github.event.inputs.build-type || inputs.build-type }}, ${{ github.event.inputs.test-category || inputs.test-category }})
+ name: Test (${{ github.event.inputs.build-type || inputs.build-type }}, ${{ github.event.inputs.test-category || inputs.test-category || 'Simple' }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -43,7 +47,7 @@ jobs:
dotnet-version: '8.0.x'
- name: Build
run: |
- dotnet build build\Stride.Tests.${{ github.event.inputs.test-category || inputs.test-category }}.slnf `
+ dotnet build build\Stride.Tests.${{ github.event.inputs.test-category || inputs.test-category || 'Simple' }}.slnf `
-restore -m:1 -nr:false `
-v:m -p:WarningLevel=0 `
-p:Configuration=${{ github.event.inputs.build-type || inputs.build-type }} `
@@ -51,6 +55,6 @@ jobs:
-p:StrideGraphicsApis=OpenGL
- name: Test
run: |
- dotnet test build\Stride.Tests.${{ github.event.inputs.test-category || inputs.test-category }}.slnf `
+ dotnet test build\Stride.Tests.${{ github.event.inputs.test-category || inputs.test-category || 'Simple' }}.slnf `
--no-build `
-p:Configuration=${{ github.event.inputs.build-type || inputs.build-type }}
diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml
index 449a83eb6e..8d6136c078 100644
--- a/.github/workflows/test-windows.yml
+++ b/.github/workflows/test-windows.yml
@@ -39,6 +39,10 @@ on:
default: Simple
type: string
+concurrency:
+ group: test-windows-${{ github.event.pull_request.number || github.ref }}-${{ github.event.inputs.build-type || inputs.build-type || 'Debug' }}-${{ github.event.inputs.test-category || inputs.test-category || 'Simple' }}
+ cancel-in-progress: true
+
jobs:
#
# Test Stride on Windows
diff --git a/sources/Directory.Packages.props b/sources/Directory.Packages.props
index 28607e25a4..6368b59dc8 100644
--- a/sources/Directory.Packages.props
+++ b/sources/Directory.Packages.props
@@ -11,6 +11,7 @@
+
diff --git a/sources/buildengine/Stride.Core.BuildEngine.Common/MicrothreadLocalDatabases.cs b/sources/buildengine/Stride.Core.BuildEngine.Common/MicrothreadLocalDatabases.cs
index 8c892bea0e..1a99c7f97f 100644
--- a/sources/buildengine/Stride.Core.BuildEngine.Common/MicrothreadLocalDatabases.cs
+++ b/sources/buildengine/Stride.Core.BuildEngine.Common/MicrothreadLocalDatabases.cs
@@ -113,6 +113,11 @@ private static DatabaseFileProvider CreateDatabase(BuildTransaction transaction)
private class MicroThreadLocalProviderService : IDatabaseFileProviderService
{
- public DatabaseFileProvider FileProvider => MicroThreadLocalDatabaseFileProvider.Value;
+ public DatabaseFileProvider FileProvider
+ {
+ get => MicroThreadLocalDatabaseFileProvider.Value;
+ set => MicroThreadLocalDatabaseFileProvider.Value = value;
+ //throw new InvalidOperationException($"Can not change the value of a {nameof(MicroThreadLocalProviderService.FileProvider)}");
+ }
}
}
diff --git a/sources/core/Stride.Core.Serialization/IO/IDatabaseFileProviderService.cs b/sources/core/Stride.Core.Serialization/IO/IDatabaseFileProviderService.cs
index 93c36db2f8..7d251cd2c2 100644
--- a/sources/core/Stride.Core.Serialization/IO/IDatabaseFileProviderService.cs
+++ b/sources/core/Stride.Core.Serialization/IO/IDatabaseFileProviderService.cs
@@ -5,5 +5,5 @@ namespace Stride.Core.IO;
public interface IDatabaseFileProviderService
{
- DatabaseFileProvider FileProvider { get; }
-}
\ No newline at end of file
+ DatabaseFileProvider FileProvider { get; set; }
+}
diff --git a/sources/core/Stride.Core.Serialization/Serialization/Contents/IContentManager.cs b/sources/core/Stride.Core.Serialization/Serialization/Contents/IContentManager.cs
index baf4983438..d495e40f7c 100644
--- a/sources/core/Stride.Core.Serialization/Serialization/Contents/IContentManager.cs
+++ b/sources/core/Stride.Core.Serialization/Serialization/Contents/IContentManager.cs
@@ -25,6 +25,19 @@ public interface IContentManager
/// A stream to the raw asset.
Stream OpenAsStream(string url, StreamFlags streamFlags = StreamFlags.None);
+ ///
+ /// Saves an asset at a specific URL.
+ ///
+ /// The URL.
+ /// The asset.
+ /// The custom storage type to use. Use null as default.
+ ///
+ /// url
+ /// or
+ /// asset
+ ///
+ void Save(string url, object asset, Type? storageType);
+
///
/// Loads content from the specified URL.
///
diff --git a/sources/core/Stride.Core/IServiceRegistry.cs b/sources/core/Stride.Core/IServiceRegistry.cs
index c2b564561a..9f25c94df1 100644
--- a/sources/core/Stride.Core/IServiceRegistry.cs
+++ b/sources/core/Stride.Core/IServiceRegistry.cs
@@ -47,6 +47,15 @@ public interface IServiceRegistry
/// Thrown when a service of the same type is already registered.
void AddService(T service) where T : class;
+ ///
+ /// Adds a service to this .
+ ///
+ /// The service to add.
+ /// The type to register as.
+ /// Thrown when the provided service is null.
+ /// Thrown when a service of the same type is already registered.
+ void AddService(object service, Type type);
+
///
/// Gets the service object of the specified type.
///
diff --git a/sources/core/Stride.Core/ServiceRegistry.cs b/sources/core/Stride.Core/ServiceRegistry.cs
index 09b7543516..ca5dcede37 100644
--- a/sources/core/Stride.Core/ServiceRegistry.cs
+++ b/sources/core/Stride.Core/ServiceRegistry.cs
@@ -76,6 +76,22 @@ public void AddService(T service)
OnServiceAdded(new ServiceEventArgs(type, service));
}
+ ///
+ ///
+ /// This implementation triggers the event after a service is successfully added.
+ ///
+ public void AddService(object service, Type type)
+ {
+ ArgumentNullException.ThrowIfNull(service);
+
+ lock (registeredService)
+ {
+ if (!registeredService.TryAdd(type, service))
+ throw new ArgumentException("Service is already registered with this type", nameof(type));
+ }
+ OnServiceAdded(new ServiceEventArgs(type, service));
+ }
+
///
///
/// This implementation triggers the event after a service is successfully removed.
diff --git a/sources/editor/Stride.Assets.Presentation/AssetEditors/EntityHierarchyEditor/Game/EntityHierarchyEditorGame.cs b/sources/editor/Stride.Assets.Presentation/AssetEditors/EntityHierarchyEditor/Game/EntityHierarchyEditorGame.cs
index 589ceaeccb..b0059ad35d 100644
--- a/sources/editor/Stride.Assets.Presentation/AssetEditors/EntityHierarchyEditor/Game/EntityHierarchyEditorGame.cs
+++ b/sources/editor/Stride.Assets.Presentation/AssetEditors/EntityHierarchyEditor/Game/EntityHierarchyEditorGame.cs
@@ -48,7 +48,8 @@ public abstract class EntityHierarchyEditorGame : EditorServiceGame
private Material fallbackColorMaterial;
private Material fallbackTextureMaterial;
- protected EntityHierarchyEditorGame(TaskCompletionSource gameContentLoadedTaskSource, IEffectCompiler effectCompiler, string effectLogPath)
+ protected EntityHierarchyEditorGame(TaskCompletionSource gameContentLoadedTaskSource, IEffectCompiler effectCompiler, string effectLogPath, GameContext context = null)
+ : base(context)
{
this.gameContentLoadedTaskSource = gameContentLoadedTaskSource;
this.effectCompiler = effectCompiler;
diff --git a/sources/editor/Stride.Editor/EditorGame/Game/EditorServiceGame.cs b/sources/editor/Stride.Editor/EditorGame/Game/EditorServiceGame.cs
index bd04fdc2b0..25a80860c5 100644
--- a/sources/editor/Stride.Editor/EditorGame/Game/EditorServiceGame.cs
+++ b/sources/editor/Stride.Editor/EditorGame/Game/EditorServiceGame.cs
@@ -99,6 +99,11 @@ public bool IsEditorHidden
public event EventHandler ExceptionThrown;
+ public EditorServiceGame(GameContext context) : base(context)
+ {
+
+ }
+
///
/// Calculates and returns the position of the mouse in the scene.
///
diff --git a/sources/editor/Stride.Editor/Engine/EmbeddedGame.cs b/sources/editor/Stride.Editor/Engine/EmbeddedGame.cs
index 5eab6d24fc..66d262c9c3 100644
--- a/sources/editor/Stride.Editor/Engine/EmbeddedGame.cs
+++ b/sources/editor/Stride.Editor/Engine/EmbeddedGame.cs
@@ -3,6 +3,7 @@
using Stride.Core.Diagnostics;
using Stride.Engine;
+using Stride.Games;
using Stride.Graphics;
namespace Stride.Editor.Engine
@@ -17,7 +18,7 @@ public class EmbeddedGame : Game
///
public static bool DebugMode { get; set; }
- public EmbeddedGame()
+ public EmbeddedGame(GameContext context) : base(context)
{
GraphicsDeviceManager.PreferredGraphicsProfile = new [] { GraphicsProfile.Level_11_0, GraphicsProfile.Level_10_1, GraphicsProfile.Level_10_0 };
GraphicsDeviceManager.PreferredBackBufferWidth = 64;
diff --git a/sources/editor/Stride.Editor/Preview/GameStudioPreviewService.cs b/sources/editor/Stride.Editor/Preview/GameStudioPreviewService.cs
index 522b71f911..99047e09fa 100644
--- a/sources/editor/Stride.Editor/Preview/GameStudioPreviewService.cs
+++ b/sources/editor/Stride.Editor/Preview/GameStudioPreviewService.cs
@@ -137,8 +137,8 @@ private void StrideUIThread()
initializationSignal.Set();
- PreviewGame = new PreviewGame(AssetBuilderService.EffectCompiler);
var context = new GameContextWinforms(gameForm) { InitializeDatabase = false };
+ PreviewGame = new PreviewGame(AssetBuilderService.EffectCompiler, context);
// Wait for shaders to be loaded
AssetBuilderService.WaitForShaders();
diff --git a/sources/editor/Stride.Editor/Preview/PreviewGame.cs b/sources/editor/Stride.Editor/Preview/PreviewGame.cs
index c88ac25032..b7a5a8c9f1 100644
--- a/sources/editor/Stride.Editor/Preview/PreviewGame.cs
+++ b/sources/editor/Stride.Editor/Preview/PreviewGame.cs
@@ -2,15 +2,16 @@
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
using System;
using System.Threading.Tasks;
-using Stride.Core.BuildEngine;
-using Stride.Core;
-using Stride.Core.Diagnostics;
-using Stride.Core.Mathematics;
using Stride.Assets;
using Stride.Assets.SpriteFont;
using Stride.Assets.SpriteFont.Compiler;
+using Stride.Core;
+using Stride.Core.BuildEngine;
+using Stride.Core.Diagnostics;
+using Stride.Core.Mathematics;
using Stride.Engine;
using Stride.Engine.Design;
+using Stride.Games;
using Stride.Graphics;
using Stride.Rendering.Compositing;
using Stride.Shaders.Compiler;
@@ -43,7 +44,7 @@ public class PreviewGame : EditorGame.Game.EditorServiceGame
private Scene previewScene;
- public PreviewGame(IEffectCompiler effectCompiler)
+ public PreviewGame(IEffectCompiler effectCompiler, GameContext context) : base(context)
{
this.effectCompiler = effectCompiler;
}
diff --git a/sources/engine/Stride.Debugger/Debugger/LiveAssemblyReloader.cs b/sources/engine/Stride.Debugger/Debugger/LiveAssemblyReloader.cs
index 67c314e85f..bb4d910626 100644
--- a/sources/engine/Stride.Debugger/Debugger/LiveAssemblyReloader.cs
+++ b/sources/engine/Stride.Debugger/Debugger/LiveAssemblyReloader.cs
@@ -1,29 +1,30 @@
-// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
+// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
using System;
using System.Collections.Generic;
-using System.Linq;
using System.Reflection;
using Stride.Core;
using Stride.Core.Reflection;
-using Stride.Core.Serialization;
using Stride.Core.Yaml;
using Stride.Core.Yaml.Events;
using Stride.Core.Yaml.Serialization;
using Stride.Debugger.Target;
using Stride.Engine;
+using Stride.Games;
namespace Stride.Debugger
{
public static class LiveAssemblyReloader
{
- public static void Reload(Game game, AssemblyContainer assemblyContainer, List assembliesToUnregister, List assembliesToRegister)
+ public static void Reload(GameBase game, AssemblyContainer assemblyContainer, List assembliesToUnregister, List assembliesToRegister)
{
List entities = new List();
+ var sceneSystem = game.Services.GetSafeServiceAs();
+
if (game != null)
- entities.AddRange(game.SceneSystem.SceneInstance);
+ entities.AddRange(sceneSystem.SceneInstance);
CloneReferenceSerializer.References = new List