Skip to content

feat: NetworkObjectSpawner for dynamically spawning in-scene placed NetworkObjects [MTT-1558] #717

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

Merged
merged 12 commits into from
Aug 26, 2022

Conversation

fernando-cortez
Copy link
Collaborator

@fernando-cortez fernando-cortez commented Aug 24, 2022

Description

This PR resolves the issue encountered when joining a game session already underway, where the late-joiner would see ghost imps. In-scene placed NetworkObjects were destroyed & despawned on the server, and so the joining client would always load new NetworkObjects which were not synchronized with the server.

Here, NetworkObjectSpawner component can be added to a GameObject inside a scene/prefab to spawn a NetworkObject when NetworkSceneManager's OnLoadEventCompleted is invoked. The wrapper is destroyed after the NetworkObject is spawned inside the server, and otherwise on Awake() on clients, to reduce memory buildup.

Gizmos have been added as a way to at-a-glance spot NetworkObjects in a scene/prefab that will be spawned. I would love to add meshes as a preview, but in my opinion that's more of a nice-to-have, cosmetic, editor tool.

An extra: VandalImpGraphics had an unnecessary NetworkObject added to it which prevented spawns on the entrance area. This has been removed.

Issue Number(s)

MTT-1558

Contribution checklist

  • Tests have been added for boss room and/or utilities pack
  • Release notes have been added to the project changelog file and/or package changelog file
  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • JIRA ticket ID is in the PR title or at least one commit message
  • Include the ticket ID number within the body message of the PR to create a hyperlink

SamuelBellomo
SamuelBellomo previously approved these changes Aug 24, 2022
Copy link
Contributor

@LPLafontaineB LPLafontaineB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really elegant solution! Something that might be an issue, though, is that now the dynamically-spawned imps are no longer linked to their respective additive scene. So if we move out of it and it gets unloaded, the imps still stay there, but if we come back to it and it gets loaded again, the imps get re-spawned. This means we can have multiple bosses or vandal imps at once

SamuelBellomo
SamuelBellomo previously approved these changes Aug 26, 2022
SamuelBellomo
SamuelBellomo previously approved these changes Aug 26, 2022
LPLafontaineB
LPLafontaineB previously approved these changes Aug 26, 2022
@fernando-cortez fernando-cortez added 2-One More Review One review in, one to go and removed 1-Needs Review PR needs attention from the assignee and reviewers labels Aug 26, 2022
@fernando-cortez fernando-cortez merged commit d2bd5b4 into develop Aug 26, 2022
@fernando-cortez fernando-cortez deleted the feature/networkobject-spawner branch August 26, 2022 18:57
@fernando-cortez fernando-cortez added 3-Good to Merge and removed 2-One More Review One review in, one to go labels Aug 26, 2022
@SamuelBellomo SamuelBellomo linked an issue Sep 13, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Boss Room v1.2.0 reconnection See the dead imp
4 participants