Missing built in enum reference?
Hello, I am trying to figure out why my build will not compile. I am getting the Error CS0246 saying I am missing an assembly or reference for 'NetworkDisconnection' which is a built in Unity enum. In the code I have the using UnityEngine and using System.Collections, which I know the 'NetworkDisconnection' enum is a part of. Any clue how to fix? This is the code that is throwing the error
void OnDisconnectedFromServer( NetworkDisconnection cause )
{
Destroy( gameObject );
}
The same error is occurring for $$anonymous$$ovieTexture, although not an enum, it is built into Unity, so I dont know why this is happening.
$$anonymous$$ake another project and see if the errors are still popping up in that new project?
Answer by phxvyper · Jun 17, 2016 at 08:49 PM
After some very obscure googling (I don't blame you for not finding the answer with some googles, took me a few minutes), I found out why this happens on WebGL:
According to the WebGL Documentation on Networking
"Due to security implications, JavaScript code does not have direct access to IP Sockets to implement network connectivity. As a result, the .NET networking classes (ie, everything in the System.Net namespace, particularly System.Net.Sockets) are non-functional in WebGL. The same applies to Unity’s old UnityEngine.Network classes, which are not available when building for WebGL.
If you need to use Networking in WebGL, you currently have the options to use the WWW or UnityWebRequest classes in Unity or the new Unity Networking features which support WebGL, or to implement your own networking using WebSockets or WebRTC in JavaScript."
Your answer
Follow this Question
Related Questions
C# to WebGL 2 Answers
WebGL issue - Release Build triggers error, Development Build runs fine 0 Answers
How to Make Proper Font used in WebGL build? 2 Answers
Can Unity Games be put on a website that will work on a chrome book 0 Answers
For the WebGL build, in saving / loading games, what is the value of Application.persistentDataPath? 0 Answers