Issue with PhotonServerSettings load

Options
here is the error
UnityException: Load is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'PhotonCustomRoomMatch' on game object 'CMMRoomController'.
See "Script Serialization" page in the Unity Manual for further details.
Photon.Pun.PhotonNetwork..cctor () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:116)
Rethrow as TypeInitializationException: The type initializer for 'Photon.Pun.PhotonNetwork' threw an exception.
Photon.Pun.PhotonEditor.OnUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/Editor/PhotonEditor.cs:200)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:200)


and the code it brings me to this code.
public static ServerSettings PhotonServerSettings =(ServerSettings)Resources.Load(PhotonNetwork.ServerSettingsFileName, typeof(ServerSettings));

and I don't know how to put in an awake without it complaining that you can't put awake in a static class.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @IanDircks,

    Thank you for choosing Photon!

    Try closing and opening Unity again.
    According to this discussion, that helps.
    What Unity version is this?
    What PUN version is this?

    If the issue persists:
    Could you reproduce this in a new fresh clean empty project with just PUN2 imported? try any of the demo scenes.
  • IanDircks
    Options
    The issue was fixed when I updated to unity 9f1 it must have just been an engine issue.