MonoMod / MonoMod.Common

Common code used by MonoMod and other .NET modding libraries. Not to be confused with MonoMod.Utils (for mods).
MIT License
75 stars 33 forks source link

Allow PlatformHelper.Current to be set externally #9

Closed bbepis closed 4 years ago

bbepis commented 4 years ago

Allow PlatformHelper.Current to be set externally, only when the property hasn't been set yet.

As discussed, being able to set this allows for BepInEx to manually set the platform without needing to execute the static constructor, which can cause issues on some Unity versions.

The property has a lock to prevent writes once the property has been read by anything, to prevent any inconsistencies arising from two different values being read during later execution.