Only one error: Error building Player because scripts have compile errors in the editor

Hey guys,

I looked all over for the answer to this question and just could not find it. I started a new project whose goal was to test out and learn things about networking in Unity. It is currently super simple. It has one empty object with one script on it in C#, plus the default camera and lights. I changed the camera background to black and clear flags to solid color. Below is the script I am using in Visual Studio and the error log I am receiving when trying to build. I am only getting one error and is not telling me exactly what is wrong. I build on the Windows Store Platform, UWP is D3D, SDK is Windows 10 Universal, and debugging Unity C# projects is checked. Any help would be greatly appreciated.

Thanks.

Errors:

Error building Player because scripts have compile errors in the editor

Code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NetworkManagerScript : MonoBehaviour {

    //Button Positions
    float buttonX = 100;
    float buttonY = 100;
    float buttonW = 250;
    float buttonH = 100;
    string typeName = "Super Unique Network Type Name";
    string gameName = "Network Practice";
    private HostData[] hostList;

    //Starts the server
    private void StartServer()
    {
        Network.InitializeServer(2, 25001, !Network.HavePublicAddress());
        MasterServer.RegisterHost(typeName, gameName, "Learning Network Skills");
    }

    //Gets called when server is initialized
    void OnServerInitialized()
    {
        Debug.Log("Server Initializied");
    }

    //GUI
    void OnGUI()
    {
        //If you aren't connected to the server...
        if (!Network.isClient && !Network.isServer)
        {
            //Creates a button and if you click it...
            if (GUI.Button(new Rect(buttonX, buttonY, buttonW, buttonH), "Start Server"))
            {
                StartServer();
                Debug.Log("It worked!");
            }

            //Creates button and if you click it...
            if (GUI.Button(new Rect(buttonX, buttonY + 150, buttonW, buttonH), "Refresh Hosts"))
            {
                RefreshHostList();
                Debug.Log("Refreshing...");
            }

            //If the request is not empty...
            if (hostList != null)
            {
                //For each guy in the host list...
                for (int i = 0; i < hostList.Length; i++)
                {
                    //Creates a button and if you click it...
                    if (GUI.Button(new Rect(4 * buttonX, buttonY + (110 * i), buttonW + 50, buttonH), hostList*.gameName))*

{
JoinServer(hostList*);*
}
}
}
}
}

//Requests host data
private void RefreshHostList()
{
MasterServer.RequestHostList(typeName);
}

//If it finds the host data from the above function, it stores it in hostList
void OnMasterServerEvent(MasterServerEvent msEvent)
{
if (msEvent == MasterServerEvent.HostListReceived)
hostList = MasterServer.PollHostList();
}

//Joins the server
private void JoinServer(HostData hostData)
{
Network.Connect(hostData);
}

//Called when server is joined
void OnConnectedToServer()
{
Debug.Log(“Server Joined”);
}

}

You didn’t include

using UnityEngine.Networking;

at the start of your code. Your script doesn’t know what functions you’re trying to call! Try that first, let me know if it still fails.

I have the same issue…

error CS0246: The type or namespace name ‘HostData’ could not be found (are you missing a using directive or an assembly reference?)

I’m trying to build a UWP app.

For me the error was because some how the following using was included in one of my C# scripts.

using UnityEditorInternal;