com.unity.netcode.gameobjects icon indicating copy to clipboard operation
com.unity.netcode.gameobjects copied to clipboard

MPPM: allow scripts to determine if we're running as a virtual player

Open CodeSmile-0000011110110111 opened this issue 3 months ago • 0 comments

Is your feature request related to a problem? Please describe.
Some code shouldn't be run in a virtual player, if only for convenience. 

Most urgently: editor tools that pop up a window where you'd only want that window open in the main editor. You may not even know which editor the window belongs to and make the edits in the wrong place. A virtual player may also overwrite the same configuration file of an editor tool. 

Virtual players may also run InitOnLoad code intended to run only when the project is "opened for the first time". This may just slow down opening the editor but could also lead to issues. Again, would be helpful to be able to safeguard against this.

Describe the solution you'd like
A simple bool property like:
CurrentPlayer.IsVirtualPlayer
and correspondingly:
CurrentPlayer.IsMainEditor

Describe alternatives you've considered
Alternative? Reflection. So many things seem readily available in Multiplayer Playmode classes but nothing is public besides the tags.