Skip to content

[FEATURE] Add default scheduler in RegisterSystems in APlugin #590

@Miou-zora

Description

@Miou-zora

Problem Statement

For now, we are forced to define a scheduler in the template params of RegisterSystems of Engine::APlugin, but that's not very convenient as we are often using Update scheduler. And Engine::Core already implement this pattern which is particularly convenient, specifically when creating test and creating systems in games.

Proposed Solution

Add a default scheduler to RegisterSystems of plugins.

Use Cases

Describe how this feature would be used and who would benefit from it:

  • Use case 1: Avoid specifying scheduler to add update logic

Impact

Describe the potential impact of this feature:

  • Less code for the same purpose

Implementation Details

You could implement it like this:

template <typename... Systems> inline decltype(auto) Core::RegisterSystem(Systems... systems)
{
if (!this->_schedulers.Contains(_defaultScheduler))
{
Log::Warning(fmt::format("Trying to register systems with a default scheduler that does not exist: {}",
_defaultScheduler.name()));
}
return this->_schedulers.GetScheduler(_defaultScheduler)->AddSystems(systems...);
}

Related Issues

List any related issues or PRs:

  • None

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Not planned

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions