Closed cheneliezer closed 2 years ago
see: https://github.com/itisnajim/SocketIOUnity#receiving
UnityThread.executeInUpdate(() => {
// anything related to unity thread run it here!
objectToSpin.transform.Rotate(0, 45, 0);
});
so your code should be:
socket.OnConnected += (sender, e) =>
{
Debug.Log("connected");
UnityThread.executeInUpdate(() => {
SceneManager.LoadScene("GameScene");
});
};
thank you ! ( also socket.OnUnityThread worked ! )
using System.Collections.Generic; using SocketIOClient; using SocketIOClient.Newtonsoft.Json; using UnityEngine; using UnityEngine.UI; using Newtonsoft.Json.Linq; using UnityEngine.SceneManagement;
public class ClientSocketManager : MonoBehaviour { public SocketIOUnity socket;
} this is my code. very simple, LoadScene does not work even do the callback is called ( debug.log connected works )