Getting started with unity node and C#
I'm working through an intro course on unity and node:
The course is based on Unity 4, I'm using Unity 5. Socket.IO says it might not work with unity 5. I'm wondering if that's why I'm having so much trouble?
I copied "TestSocketIO.cs" into my Network object. I also have socketio component in the network object.
This code errors on indicated line:
public class TestSocketIO : MonoBehaviour
{
private SocketIOComponent socket;
public void Start()
{
GameObject go = GameObject.Find("SocketIO");
socket = go.GetComponent<SocketIOComponent>();//Error "Object reference not set to an instance of an object
Note that I commented out the contents of "beep.js" in socket.io. It gave me several errors and I ended up not being able to figure out why "require()" was unrecognized.
This is my first go at unity so if I'm unclear or you need more info please ask.
UPDATE
Here is my setup
Answer by Gobaz · May 21, 2016 at 09:46 PM
Im also working on learning node. :D
Anyways i dont think the error relates to node. Pretty sure the error tells you that "go" is not found or that you dont have the component on the object.
Double check you have a gameobject named: "SocketIO" And that this object has a "SocketIOComponent" component.
Yup, the gameobject name I used was "Network". Changing "SocketIO" to "Network" fixed it!
Your answer
