/// Example callback implementation:
///
/// public void OnWebRpcResponse(OperationResponse response)
/// {
/// WebRpcResponse webResponse = new WebRpcResponse(operationResponse);
/// if (webResponse.ReturnCode != 0) { //...
/// }
///
/// switch (webResponse.Name) { //...
/// }
/// // and so on
/// }
///
public static bool WebRpc(string name, object parameters)
{
return networkingPeer.WebRpc(name, parameters);
}
[Conditional("UNITY_EDITOR")]
public static void CreateSettings()
{
PhotonNetwork.PhotonServerSettings = (ServerSettings)Resources.Load(PhotonNetwork.serverSettingsAssetFile, typeof(ServerSettings));
if (PhotonNetwork.PhotonServerSettings != null)
{
return;
}
// find out if ServerSettings can be instantiated (existing script check)
ScriptableObject serverSettingTest = ScriptableObject.CreateInstance("ServerSettings");
if (serverSettingTest == null)
{
Debug.LogError("missing settings script");
return;
}
UnityEngine.Object.DestroyImmediate(serverSettingTest);
// if still not loaded, create one
if (PhotonNetwork.PhotonServerSettings == null)
{
string settingsPath = Path.GetDirectoryName(PhotonNetwork.serverSettingsAssetPath);
if (!Directory.Exists(settingsPath))
{
Directory.CreateDirectory(settingsPath);
AssetDatabase.ImportAsset(settingsPath);
}
PhotonNetwork.PhotonServerSettings = (ServerSettings)ScriptableObject.CreateInstance("ServerSettings");
if (PhotonNetwork.PhotonServerSettings != null)
{
AssetDatabase.CreateAsset(PhotonNetwork.PhotonServerSettings, PhotonNetwork.serverSettingsAssetPath);
}
else
{
Debug.LogError("PUN failed creating a settings file. ScriptableObject.CreateInstance(\"ServerSettings\") returned null. Will try again later.");
}
}
}
///