Petit problème : Unity s’arrête de fonctionner sans message d’erreur ou autre Debug Error.
Cela se produit alors que Unity compile après avoir fait un build du projet ou modifié un script.
La roue de compilation tourne, puis tout se stop, Unity ne répond plus mais Windows ne fait pas apparaître de problème type : « Unity ne répond pas … »
Je suis obligé de le fermer via le gestionnaire des taches car la fenêtre ne répond plus du tout. Même en attendant un quart d’heure, Unity ne décoince pas …
De plus, le problème est là depuis la création d’un script en particulier. Ce script utilise Photon Chat.
Auriez vous des explications à ce phénomène ?
Le script en question :
Code : Tout sélectionner
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Chat;
using ExitGames.Client.Photon;
using Photon.Pun;
using Photon.Realtime;
public class Chat : MonoBehaviour, IChatClientListener
{
public void DebugReturn(DebugLevel level, string message)
{
if (level == ExitGames.Client.Photon.DebugLevel.ERROR)
{
Debug.LogError(message);
}
else if (level == ExitGames.Client.Photon.DebugLevel.WARNING)
{
Debug.LogWarning(message);
}
else
{
Debug.Log(message);
}
}
public void OnChatStateChange(ChatState state)
{
}
public void OnConnected()
{
Debug.Log("Connected");
chatClient.Subscribe(new string[] { "test" }, 0);
}
public void OnDisconnected()
{
Debug.Log("Disconnected");
}
public void OnGetMessages(string channelName, string[] senders, object[] messages)
{
Debug.Log("Received message from channel : " + channelName + " that say : " + messages[0]);
}
public void OnPrivateMessage(string sender, object message, string channelName)
{
}
public void OnStatusUpdate(string user, int status, bool gotMessage, object message)
{
}
public void OnSubscribed(string[] channels, bool[] results)
{
Debug.Log("Subscribed");
}
public void OnUnsubscribed(string[] channels)
{
}
public void OnUserSubscribed(string channel, string user)
{
Debug.Log("User Subscribed");
}
public void OnUserUnsubscribed(string channel, string user)
{
}
ChatClient chatClient;
AppSettings chatAppSettings;
private void Start()
{
chatClient = new ChatClient(this);
chatClient.ChatRegion = "EU";
chatAppSettings = PhotonNetwork.PhotonServerSettings.AppSettings;
this.chatClient.UseBackgroundWorkerForSending = true;
chatClient.Connect(chatAppSettings.AppIdChat, "1.0", new Photon.Chat.AuthenticationValues("Player"));
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.P))
{
chatClient.PublishMessage("test", "This is a test");
}
chatClient.Service();
}
}