Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subsystem Game Instance #182

Open
phuicy opened this issue Oct 2, 2022 · 3 comments
Open

Subsystem Game Instance #182

phuicy opened this issue Oct 2, 2022 · 3 comments

Comments

@phuicy
Copy link
Contributor

phuicy commented Oct 2, 2022

Hi All,

I have a branch where I have reimplemented the GameInstance as a GameInstanceSubsystem, this allows to not need to overide other game instances; but also allows for late loading the connection.

Thoughts? Is this useful?

thanks,
Guy

@phuicy
Copy link
Contributor Author

phuicy commented Oct 3, 2022

For your consideration: https://github.com/phuicy/ROSIntegration/tree/subsystem

I would be tempted to implement in game IP selection.

@Sanic
Copy link
Contributor

Sanic commented Oct 20, 2022

Hi @phuicy
Thank you for the proposition. I haven't used subsystems so far, but they look pretty useful to me and might solve a couple of problems i sometimes had with GameInstances.
Do you think there is any caveat using them instead of normal GameInstances that we should highlight in the docs or ask other users before?

@PetterVMC
Copy link
Contributor

I agree that it should be a GameInstanceSubsystem instead of GameInstance. For example, the plugin cannot currently be used together with another plugin if the other plugin is also implemented as a GameInstance derived class, unless modifying the code so that one plugin's class derives from the other.

Looking at the way GameInstanceSubsystems' Initialize and Deinitialize methods are being called from GameInstance.cpp, changing it doesn't appear to lead to any critical change in code flow from how it is today.

@phuicy In addition to your implementation, I think it could be useful to add a static helper method to get the subsystem more easily in C++. Perhaps something like:

class ROSINTEGRATION_API UROSIntegrationGameInstance : public UGameInstanceSubsystem
{
    // ...
    static UROSIntegrationGameInstance* GetFrom(const UObject* Obj)
    {
        Obj->GetWorld()->GetGameInstance()->GetSubsystem<UROSIntegrationGameInstance>();
    }
    // ...
};

Also, a critical thing that needs to be solved is to make the properties of UROSIntegrationGameInstance accessible in the editor. From what I know a subsystem's properties will not magically show anywhere automatically. Though, it is possible to create a ROS Integration section for them in the editor's Project Settings window, which I think would be the most logical thing to do, but it requires creating an editor module and some additional code. Did you try something like that yet?

We should probably also have some code for migrating the settings from old projects to the new system seamlessly. I think core redirects can do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants