Hello,
I am currently trying to make a multiplayer game using SocketIO and node.js. My main concern is that when the client socket receives my given “spawn” message(which in turn is supposed to create a GameObject for the given ID), the line will not process and no new GameObject is created. The code in question is below:
socket.On("spawn", (data) => {
string id = (data as JObject)["id"].ToString();
Debug.Log("Spawning Player: " + id);
GameObject go = new GameObject("Player ID " + id); //create object -- code halts at this point for some reason
Debug.Log("Player Spawned: " + id);
go.transform.SetParent(networkContainer); //add object to container
serverObjects.Add(id,go); //add server object to dictionary
});
Also the code contains these imports:
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Quobject.SocketIoClientDotNet.Client;
using System;
using System.Collections;
using System.Threading.Tasks;
using UnityEngine;
I know the code is running because the “Spawning Player” shows up in the console yet the “Player Spawned” line doesn’t.
Any and every piece of information is appreciated!