Skip to content

refactor: remove NetworkManager.Singleton dependencies, add additional instance tracking and notification when LogLevel.Developer - #562

Merged
NoelStephensUnity merged 18 commits into
release/0.1.0from
fix/rpcstartupshutdown
Mar 10, 2021
Merged

refactor: remove NetworkManager.Singleton dependencies, add additional instance tracking and notification when LogLevel.Developer#562
NoelStephensUnity merged 18 commits into
release/0.1.0from
fix/rpcstartupshutdown

Conversation

@NoelStephensUnity

@NoelStephensUnity NoelStephensUnity commented Mar 9, 2021

Copy link
Copy Markdown
Member

This refactor passes the RpcQueueContainer into the RpcQueueProcessor in order to completely remove the RpcQueueContainer's dependencies on the NetworkManager.Singleton.

This refactor removes RpcQueueContainer 's dependencies upon the NetworkManager.Singleton by passing the instance of the NetworkManager that constructed it via the constructor.

This should remove all dependencies from NetworkManager.Singleton from the entire Rpc Queue System!

Refactored the constructor and made the class disposable.

Simplified-Improve the constructor process.

If you set the NetworkLog.CurrentLevel to Developer it will notify you about:

  • If more than one instance is instantiated, it generates a log for each instantiation
  • As instances are disposed, it will notify you of this.
  • It has a "most likely to never ever occur" scenario where if there are no instances but the dispose method is being called by an already invalid/disposed reference.

This refactoring includes additional checks to assure the RpcQueueContainer does not allow itself to be updated via the Network Update Loop system if there is no NetworkManager instantiated or if there is a problem with its initialization.

Refactored the constructor and made the class disposable.
Placing the increment above the log.
Moving the instance count above the logging of the instance count
Comment thread com.unity.multiplayer.mlapi/Runtime/Messaging/RpcQueue/RpcQueueContainer.cs Outdated
Had a typo that said it was initializing as opposed to shutting down.
This refactor passes the RpcQueueContainer into the RpcQueueProcessor in order to start remove the RpcQueueContainer's dependencies on the NetworkManager.Singleton.

This refactor removes RpcQueueContainer 's dependencies upon the NetworkManager.Singleton by passing the instance of the NetworkManager that constructed it.

This should remove all dependencies from NetworkManager.Singleton from the entire Rpc Queue System!
@NoelStephensUnity NoelStephensUnity changed the title refactor: better handle instantiating and detecting a lack of NetworkManager availability refactor: remove NetworkManager.Singleton dependencies, add additional instance tracking and notification when LogLevel.Developer Mar 9, 2021
This commit further improves the previous dependencies upon NetworkManager.
This also expands unit testing capabilities that now can include RpcQueueProcessor.
( just detecting if we are listening or testing )
Comment thread com.unity.multiplayer.mlapi/Runtime/Messaging/RpcQueue/RpcQueueProcessor.cs Outdated
Comment thread com.unity.multiplayer.mlapi/Runtime/Messaging/RpcQueue/RpcQueueProcessor.cs Outdated
Comment thread com.unity.multiplayer.mlapi/Runtime/Messaging/RpcQueue/RpcQueueContainer.cs Outdated
Comment thread com.unity.multiplayer.mlapi/Runtime/Messaging/RpcQueue/RpcQueueContainer.cs Outdated
…eContainer.cs


Good addition, this will assure that anyone that changes the name of the class will see the name mismatch and update the log,

Co-authored-by: M. Fatih MAR <[email protected]>
Comment thread com.unity.multiplayer.mlapi/Runtime/Messaging/RpcQueue/RpcQueueContainer.cs Outdated
Comment thread com.unity.multiplayer.mlapi/Runtime/Messaging/RpcQueue/RpcQueueContainer.cs Outdated
Comment thread com.unity.multiplayer.mlapi/Runtime/Messaging/RpcQueue/RpcQueueContainer.cs Outdated
…eContainer.cs


Same catch.. I like that approach!

Co-authored-by: M. Fatih MAR <[email protected]>
Comment thread com.unity.multiplayer.mlapi/Runtime/Messaging/RpcQueue/RpcQueueContainer.cs Outdated
Updated some minor standards related issues and wrapped all of the debug logging related code in #if UNITY_EDITOR || DEVELOPMENT_BUILD
Typo in Fatih's committed suggested fix.
:alien:
This assures that all log related messages utilize the appropriate class names.
This removes some legacy language from the log related messages.
Comment thread com.unity.multiplayer.mlapi/Runtime/Messaging/RpcQueue/RpcQueueContainer.cs Outdated
NoelStephensUnity and others added 3 commits March 9, 2021 19:00
Some minor tweaks for camelCase and spacing.
Filled out the rest of the summary for the NetworkUpdate metod in RpcQueueContainer.

@0xFA11 0xFA11 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀

Wrapping  UNITY_EDITOR || DEVELOPMENT_BUILD around a log message and the s_RpcQueueContainerInstances property.
@NoelStephensUnity
NoelStephensUnity merged commit 3673ffc into release/0.1.0 Mar 10, 2021
@NoelStephensUnity
NoelStephensUnity deleted the fix/rpcstartupshutdown branch March 10, 2021 01:27
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

Successfully merging this pull request may close these issues.

3 participants