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

feat: Adding onLocalPlayerChanged to ClientScene for when localPlayer is changed #1920

Merged
merged 2 commits into from
May 30, 2020

Conversation

James-Frowen
Copy link
Contributor

No description provided.

@James-Frowen James-Frowen changed the title adding onLocalPlayerChanged event feat: Adding onLocalPlayerChanged to ClientScene for when localPlayer is changed May 24, 2020
Co-authored-by: MrGadget <chris@clevertech.net>
@sonarcloud
Copy link

sonarcloud bot commented May 25, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@miwarnec
Copy link
Collaborator

did anyone request that feature?
why exactly do we need it?

@James-Frowen
Copy link
Contributor Author

There is no other way to detect when the local player is set other than polling the variable

needed for this #1923

It allows for scripts like this to existing with having hard scene references
https://github.com/vis2k/Mirror/blob/3ed0fac33faafd2e01d26e6b358179b82665715d/Assets/Mirror/Examples/RoomCanvas/Scripts/TogglePlayerReadyButton.cs

@miwarnec miwarnec merged commit b4acf7d into master May 30, 2020
@miwarnec miwarnec deleted the adding-localPlayerChanged-event branch May 30, 2020 13:45
github-actions bot referenced this pull request in MirageNet/Mirage Jul 4, 2020
# [34.10.0](34.9.4-master...34.10.0-master) (2020-07-04)

### Bug Fixes

* [#1659](https://github.com/MirrorNG/MirrorNG/issues/1659) Telepathy LateUpdate processes a limited amount of messages per tick to avoid deadlocks ([#1830](https://github.com/MirrorNG/MirrorNG/issues/1830)) ([d3dccd7](d3dccd7))
* Added ClientOnly check ([fb927f8](fb927f8))
* Adding warning when adding handler with RegisterSpawnHandler if assetid already exists ([#1819](https://github.com/MirrorNG/MirrorNG/issues/1819)) ([7f26329](7f26329))
* Adding warning when adding prefab with RegisterPrefab if assetid already exists ([#1828](https://github.com/MirrorNG/MirrorNG/issues/1828)) ([9f59e0c](9f59e0c))
* Allowing overrides for virtual commands to call base method ([#1944](https://github.com/MirrorNG/MirrorNG/issues/1944)) ([b92da91](b92da91))
* better error for Command, ClientRpc and TargetRpc marked as abstract ([#1947](https://github.com/MirrorNG/MirrorNG/issues/1947)) ([62257d8](62257d8))
* Better errors when trying to replace existing assetid ([#1827](https://github.com/MirrorNG/MirrorNG/issues/1827)) ([822b041](822b041))
* Cleaning up network objects when server stops ([#1864](https://github.com/MirrorNG/MirrorNG/issues/1864)) ([4c25122](4c25122))
* clear all message handlers on Shutdown ([#1829](https://github.com/MirrorNG/MirrorNG/issues/1829)) ([a6ab352](a6ab352))
* Don't call RegisterClientMessages every scene change ([#1865](https://github.com/MirrorNG/MirrorNG/issues/1865)) ([05c119f](05c119f))
* Don't call RegisterClientMessages twice ([#1842](https://github.com/MirrorNG/MirrorNG/issues/1842)) ([2a08aac](2a08aac))
* Fixed Capitalization ([c45deb8](c45deb8))
* Fixing ClientScene UnregisterPrefab ([#1815](https://github.com/MirrorNG/MirrorNG/issues/1815)) ([9270765](9270765))
* Improved error checking for ClientScene.RegisterPrefab ([#1823](https://github.com/MirrorNG/MirrorNG/issues/1823)) ([a0aa4f9](a0aa4f9))
* Improved error checking for ClientScene.RegisterPrefab with handler ([#1841](https://github.com/MirrorNG/MirrorNG/issues/1841)) ([54071da](54071da))
* making weaver include public fields in base classes in auto generated Read/Write ([#1977](https://github.com/MirrorNG/MirrorNG/issues/1977)) ([3db57e5](3db57e5))
* NetworkRoomManager.minPlayers is now protected so it's available for derived classes. ([3179f08](3179f08))
* no longer requires hook to be the first overload in a class ([#1913](https://github.com/MirrorNG/MirrorNG/issues/1913)) ([0348699](0348699))
* OnClientEnterRoom should only fire on clients ([d9b7bb7](d9b7bb7))
* Prevent host client redundantly changing to offline scene ([b4511a0](b4511a0))
* Removed unnecessary registration of player prefab in NetworkRoomManager ([b2f52d7](b2f52d7))
* Removed unused variable ([ae3dc04](ae3dc04))
* Replaced Icosphere with centered pivot ([1dc0d98](1dc0d98))
* Replacing ClearDelegates with RemoveDelegates for test ([#1971](https://github.com/MirrorNG/MirrorNG/issues/1971)) ([927c4de](927c4de))
* Suppress warning ([fffd462](fffd462))
* Use ReplaceHandler instead of RegisterHandler in NetworkManager ([ffc276c](ffc276c))
* Websockets Transport now handles being disabled for scene changes ([#1994](https://github.com/MirrorNG/MirrorNG/issues/1994)) ([5480a58](5480a58))
* WebSockets: Force KeepAliveInterval to Zero ([9a42fe3](9a42fe3))
* Wrong method names in ClientSceneTests ([ab3f353](ab3f353))

### Features

* Add excludeOwner option to ClientRpc ([#1954](https://github.com/MirrorNG/MirrorNG/issues/1954)) ([864fdd5](864fdd5)), closes [#1963](https://github.com/MirrorNG/MirrorNG/issues/1963) [#1962](https://github.com/MirrorNG/MirrorNG/issues/1962) [#1961](https://github.com/MirrorNG/MirrorNG/issues/1961) [#1960](https://github.com/MirrorNG/MirrorNG/issues/1960) [#1959](https://github.com/MirrorNG/MirrorNG/issues/1959) [#1958](https://github.com/MirrorNG/MirrorNG/issues/1958) [#1957](https://github.com/MirrorNG/MirrorNG/issues/1957) [#1956](https://github.com/MirrorNG/MirrorNG/issues/1956)
* Add NetworkServer.RemovePlayerForConnection ([#1772](https://github.com/MirrorNG/MirrorNG/issues/1772)) ([e3790c5](e3790c5))
* add SyncList.RemoveAll ([#1881](https://github.com/MirrorNG/MirrorNG/issues/1881)) ([eb7c87d](eb7c87d))
* Added virtual SyncVar hook for index in NetworkRoomPlayer ([0c3e079](0c3e079))
* Adding ignoreAuthority Option to Command ([#1918](https://github.com/MirrorNG/MirrorNG/issues/1918)) ([3ace2c6](3ace2c6))
* Adding onLocalPlayerChanged to ClientScene for when localPlayer is changed ([#1920](https://github.com/MirrorNG/MirrorNG/issues/1920)) ([b4acf7d](b4acf7d))
* adding OnRoomServerPlayersNotReady to NetworkRoomManager that is called when player ready changes and atleast 1 player is not ready ([#1921](https://github.com/MirrorNG/MirrorNG/issues/1921)) ([9ae7fa2](9ae7fa2))
* Adding ReplaceHandler functions to NetworkServer and NetworkClient ([#1775](https://github.com/MirrorNG/MirrorNG/issues/1775)) ([877f4e9](877f4e9))
* adding script that displays ping ([#1975](https://github.com/MirrorNG/MirrorNG/issues/1975)) ([7e93030](7e93030))
* Allowing Multiple Concurrent Additive Scenes ([#1697](https://github.com/MirrorNG/MirrorNG/issues/1697)) ([e32a9b6](e32a9b6))
* ClientScene uses log window ([b3656a9](b3656a9))
* Creating method to replace all log handlers ([#1880](https://github.com/MirrorNG/MirrorNG/issues/1880)) ([d8aaf76](d8aaf76))
* Experimental Network Transform ([#1990](https://github.com/MirrorNG/MirrorNG/issues/1990)) ([7e2b733](7e2b733))
* Improved Log Settings Window Appearance ([#1885](https://github.com/MirrorNG/MirrorNG/issues/1885)) ([69b8451](69b8451))
* Improved RoomPayer template ([042b4e1](042b4e1))
* LogSettings that can be saved and included in a build ([#1863](https://github.com/MirrorNG/MirrorNG/issues/1863)) ([fd4357c](fd4357c))
* Multiple Concurrent Additive Physics Scenes Example ([#1686](https://github.com/MirrorNG/MirrorNG/issues/1686)) ([87c6ebc](87c6ebc))
* NetworkConnection to client and server use logger framework ([72154f1](72154f1))
* NetworkConnection uses logging framework ([ec319a1](ec319a1))
* NetworkIdentity use logger framework ([2e39e13](2e39e13))
* NetworkServer uses new logging framework ([8b4f105](8b4f105))
* Prettify Log Names ([c7d8c09](c7d8c09))
* Use SortedDictionary for LogSettings ([#1914](https://github.com/MirrorNG/MirrorNG/issues/1914)) ([7d4c0a9](7d4c0a9))

### Performance Improvements

* NetworkProximityChecker checks Server.connections instead of doing 10k sphere casts for 10k monsters. 2k NetworkTransforms demo is significantly faster. Stable 80fps instead of 500ms freezes in between. ([#1852](https://github.com/MirrorNG/MirrorNG/issues/1852)) ([2d89f05](2d89f05))
github-actions bot referenced this pull request in MirageNet/Mirage Jul 4, 2020
… is changed (#1920)

* adding onLocalPlayerChanged event

* Update Assets/Mirror/Runtime/ClientScene.cs

Co-authored-by: MrGadget <chris@clevertech.net>

Co-authored-by: MrGadget <chris@clevertech.net>
github-actions bot referenced this pull request in MirageNet/Mirage Jul 4, 2020
# [34.10.0](34.9.4-master...34.10.0-master) (2020-07-04)

### Bug Fixes

* [#1659](https://github.com/MirrorNG/MirrorNG/issues/1659) Telepathy LateUpdate processes a limited amount of messages per tick to avoid deadlocks ([#1830](https://github.com/MirrorNG/MirrorNG/issues/1830)) ([d3dccd7](d3dccd7))
* Added ClientOnly check ([fb927f8](fb927f8))
* Adding warning when adding handler with RegisterSpawnHandler if assetid already exists ([#1819](https://github.com/MirrorNG/MirrorNG/issues/1819)) ([7f26329](7f26329))
* Adding warning when adding prefab with RegisterPrefab if assetid already exists ([#1828](https://github.com/MirrorNG/MirrorNG/issues/1828)) ([9f59e0c](9f59e0c))
* Allowing overrides for virtual commands to call base method ([#1944](https://github.com/MirrorNG/MirrorNG/issues/1944)) ([b92da91](b92da91))
* better error for Command, ClientRpc and TargetRpc marked as abstract ([#1947](https://github.com/MirrorNG/MirrorNG/issues/1947)) ([62257d8](62257d8))
* Better errors when trying to replace existing assetid ([#1827](https://github.com/MirrorNG/MirrorNG/issues/1827)) ([822b041](822b041))
* Cleaning up network objects when server stops ([#1864](https://github.com/MirrorNG/MirrorNG/issues/1864)) ([4c25122](4c25122))
* clear all message handlers on Shutdown ([#1829](https://github.com/MirrorNG/MirrorNG/issues/1829)) ([a6ab352](a6ab352))
* Don't call RegisterClientMessages every scene change ([#1865](https://github.com/MirrorNG/MirrorNG/issues/1865)) ([05c119f](05c119f))
* Don't call RegisterClientMessages twice ([#1842](https://github.com/MirrorNG/MirrorNG/issues/1842)) ([2a08aac](2a08aac))
* Fixed Capitalization ([c45deb8](c45deb8))
* Fixing ClientScene UnregisterPrefab ([#1815](https://github.com/MirrorNG/MirrorNG/issues/1815)) ([9270765](9270765))
* Improved error checking for ClientScene.RegisterPrefab ([#1823](https://github.com/MirrorNG/MirrorNG/issues/1823)) ([a0aa4f9](a0aa4f9))
* Improved error checking for ClientScene.RegisterPrefab with handler ([#1841](https://github.com/MirrorNG/MirrorNG/issues/1841)) ([54071da](54071da))
* making weaver include public fields in base classes in auto generated Read/Write ([#1977](https://github.com/MirrorNG/MirrorNG/issues/1977)) ([3db57e5](3db57e5))
* NetworkRoomManager.minPlayers is now protected so it's available for derived classes. ([3179f08](3179f08))
* no longer requires hook to be the first overload in a class ([#1913](https://github.com/MirrorNG/MirrorNG/issues/1913)) ([0348699](0348699))
* OnClientEnterRoom should only fire on clients ([d9b7bb7](d9b7bb7))
* Prevent host client redundantly changing to offline scene ([b4511a0](b4511a0))
* Removed unnecessary registration of player prefab in NetworkRoomManager ([b2f52d7](b2f52d7))
* Removed unused variable ([ae3dc04](ae3dc04))
* Replaced Icosphere with centered pivot ([1dc0d98](1dc0d98))
* Replacing ClearDelegates with RemoveDelegates for test ([#1971](https://github.com/MirrorNG/MirrorNG/issues/1971)) ([927c4de](927c4de))
* Suppress warning ([fffd462](fffd462))
* Use ReplaceHandler instead of RegisterHandler in NetworkManager ([ffc276c](ffc276c))
* Websockets Transport now handles being disabled for scene changes ([#1994](https://github.com/MirrorNG/MirrorNG/issues/1994)) ([5480a58](5480a58))
* WebSockets: Force KeepAliveInterval to Zero ([9a42fe3](9a42fe3))
* Wrong method names in ClientSceneTests ([ab3f353](ab3f353))

### Features

* Add excludeOwner option to ClientRpc ([#1954](https://github.com/MirrorNG/MirrorNG/issues/1954)) ([864fdd5](864fdd5)), closes [#1963](https://github.com/MirrorNG/MirrorNG/issues/1963) [#1962](https://github.com/MirrorNG/MirrorNG/issues/1962) [#1961](https://github.com/MirrorNG/MirrorNG/issues/1961) [#1960](https://github.com/MirrorNG/MirrorNG/issues/1960) [#1959](https://github.com/MirrorNG/MirrorNG/issues/1959) [#1958](https://github.com/MirrorNG/MirrorNG/issues/1958) [#1957](https://github.com/MirrorNG/MirrorNG/issues/1957) [#1956](https://github.com/MirrorNG/MirrorNG/issues/1956)
* Add NetworkServer.RemovePlayerForConnection ([#1772](https://github.com/MirrorNG/MirrorNG/issues/1772)) ([e3790c5](e3790c5))
* add SyncList.RemoveAll ([#1881](https://github.com/MirrorNG/MirrorNG/issues/1881)) ([eb7c87d](eb7c87d))
* Added virtual SyncVar hook for index in NetworkRoomPlayer ([0c3e079](0c3e079))
* Adding ignoreAuthority Option to Command ([#1918](https://github.com/MirrorNG/MirrorNG/issues/1918)) ([3ace2c6](3ace2c6))
* Adding onLocalPlayerChanged to ClientScene for when localPlayer is changed ([#1920](https://github.com/MirrorNG/MirrorNG/issues/1920)) ([b4acf7d](b4acf7d))
* adding OnRoomServerPlayersNotReady to NetworkRoomManager that is called when player ready changes and atleast 1 player is not ready ([#1921](https://github.com/MirrorNG/MirrorNG/issues/1921)) ([9ae7fa2](9ae7fa2))
* Adding ReplaceHandler functions to NetworkServer and NetworkClient ([#1775](https://github.com/MirrorNG/MirrorNG/issues/1775)) ([877f4e9](877f4e9))
* adding script that displays ping ([#1975](https://github.com/MirrorNG/MirrorNG/issues/1975)) ([7e93030](7e93030))
* Allowing Multiple Concurrent Additive Scenes ([#1697](https://github.com/MirrorNG/MirrorNG/issues/1697)) ([e32a9b6](e32a9b6))
* ClientScene uses log window ([b3656a9](b3656a9))
* Creating method to replace all log handlers ([#1880](https://github.com/MirrorNG/MirrorNG/issues/1880)) ([d8aaf76](d8aaf76))
* Experimental Network Transform ([#1990](https://github.com/MirrorNG/MirrorNG/issues/1990)) ([7e2b733](7e2b733))
* Improved Log Settings Window Appearance ([#1885](https://github.com/MirrorNG/MirrorNG/issues/1885)) ([69b8451](69b8451))
* Improved RoomPayer template ([042b4e1](042b4e1))
* LogSettings that can be saved and included in a build ([#1863](https://github.com/MirrorNG/MirrorNG/issues/1863)) ([fd4357c](fd4357c))
* Multiple Concurrent Additive Physics Scenes Example ([#1686](https://github.com/MirrorNG/MirrorNG/issues/1686)) ([87c6ebc](87c6ebc))
* NetworkConnection to client and server use logger framework ([72154f1](72154f1))
* NetworkConnection uses logging framework ([ec319a1](ec319a1))
* NetworkIdentity use logger framework ([2e39e13](2e39e13))
* NetworkServer uses new logging framework ([8b4f105](8b4f105))
* Prettify Log Names ([c7d8c09](c7d8c09))
* Use SortedDictionary for LogSettings ([#1914](https://github.com/MirrorNG/MirrorNG/issues/1914)) ([7d4c0a9](7d4c0a9))

### Performance Improvements

* NetworkProximityChecker checks Server.connections instead of doing 10k sphere casts for 10k monsters. 2k NetworkTransforms demo is significantly faster. Stable 80fps instead of 500ms freezes in between. ([#1852](https://github.com/MirrorNG/MirrorNG/issues/1852)) ([2d89f05](2d89f05))
miwarnec added a commit that referenced this pull request Mar 6, 2021
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.

None yet

3 participants