Tessalator Posted October 22, 2021 Share Posted October 22, 2021 (edited) I'm seeing some previews for 2.15 systems. Any news on the C# side? 2.15 C# Wish List C#10/.Net6 - (especially for record struct) Services Containers/Dependency Injection! The engine runs fine in a container, but components require a workaround. ``` // Unigine Simple DI public static ServiceProvider ServiceProvider; static Launch() { ServiceCollection services = new(); _ = services.AddSingleton<System__Logic>(); _ = services.AddSingleton<World__Logic>(); _ = services.AddSingleton<Editor__Logic>(); _ = services.AddSingleton<MessageBus>(); AddWorldServices(services); ServiceProvider = services.BuildServiceProvider(); } [STAThread] static void Main(string[] args) { Engine.Init(args); System__Logic systemLogic = ServiceProvider.GetRequiredService<System__Logic>(); World__Logic worldLogic = ServiceProvider.GetRequiredService<World__Logic>(); Editor__Logic editorLogic = ServiceProvider.GetRequiredService<Editor__Logic>(); Engine.Main(systemLogic, worldLogic, editorLogic); Engine.Shutdown(); } ``` For components we need Service Locator ``` class MyComponent : Component { readonly _messageBus; override OnReady(){ _messageBus = UnigineApp.ServiceProvider.GetRequiredService<MessageBus>(); } } ``` Even partial support would be nice. For example, CSProperty builder could option have a "IServiceProvider" property that we supply. If the property isn't null it uses ActivatorUtility instead of Activator when it can. Task and (Some) Async Overloads for Engine Activations and Delegates In general, I'd like more Task/async methods in most areas outside the game loop. There are useful C#10 features that this enables. Task is more flex than bool, but could be `Task<bool>`. ``` public override Task Init(){} public async override Task<bool>Init(){} ``` Async Layer / Control Layer For running User/Real Time async processes (not related to Game.Time or Frames). The scenario is, with the new Input system we can attach callbacks to mouse/input events. This layer would support launching long-running async (business-type) processes without impacting the "sim" layer. It's like a control panel or business layer for the world. Select Base Component Components can be extended with bases classes, but the inheritance must be manually changed. Provide a config default switch for selecting a default class (derived from Component). Could be selectable in the creation screen too. Separate Components Move Components "up" a little an give use more control to clean and create (e.g., generate a GUID or convert/import a `class : Component`) Move "C# Components" from Properties into its own tab. * New Input System It would be helpful to capture the Game.Time on mouse down. This allows get a "pressed duration" directly from mouse data. Edited October 22, 2021 by Tessalator deletion 1 1 Link to comment
silent Posted October 25, 2021 Share Posted October 25, 2021 Tessalator Thanks for the suggestions! We need to review them before implementing, so I can't give you any feedback regarding most of them right now. At this moment we don't have plans to update .NET version to 6 in the upcoming 2.15 SDK release. More likely we would have more time for that task next year (in 2.16+). How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Recommended Posts