Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

Network does not exist in this context

Why does this code not work? Not recognizing Network.Connect or any other methods. Will not compile.


using UnityEngine;
using System.Collections;
using UnityEngine.Networking;
using System.Net;
using System.IO;
using System.Collections.Generic;
using System;

public class SwitchCommander : MonoBehaviour
private bool switchOn = false;
Renderer rend;

private string url = "";
private string urlON = "";
private string urlOFF = "";

void Start()
    rend = GetComponent<Renderer>();


// called when selected
void OnSelect()
    switchOn = !switchOn;
    if (switchOn)


private void decideColor()
    if (switchOn == false)
        rend.material.color = Color.red;
    else if (switchOn == true)
        rend.material.color = Color.green;





  • Jimbohalo10Jimbohalo10 ✭✭✭
    edited August 2016

    I am using Unity 5.4f1 comment out the first URL line
    "//private string url = ""; " compiles in mono editor.
    I have attached script to main camera and now has runtime error.

    MissingComponentException: There is no 'Renderer' attached to the "Main Camera" game object, but a script is trying to access it.

    You probably need to add a Renderer to the game object "Main Camera". Or your script needs to check if the component is attached before using it.

    SwitchCommander.decideColor () (at Assets/SwitchCommander.cs:44)
    SwitchCommander.Start () (at Assets/SwitchCommander.cs:20)

    You will need to set up a HoloLens Renderer to make this work see

    BTW probably better to ask this on the Questions and Answers area
    Perhaps the moderator will move it over for you

  • Network.Connect is not recognized that is my question. I have renderer, just did not include in this snip. Private string url being commented out also would not cause network.connect to not be recognized.

  • Moving this discussion to the Q and A category

  • timgtimg mod
    edited August 2016

    Hi @mstew1110,

    In Unity's Player Settings for Windows Store under Publishing Settings, make sure you have selected the "InternetClient" (and maybe "PrivateNetworkClientServer") capability. Note, you may need to delete your "app" directory (where you tell Unity's build settings dialog to build to) as sometimes Unity doesn't update the AppX manifest for the Visual Studio solution when you change capabilities.

  • @timg I have done all of that already still no luck. Could this be a silver light issue?

  • @mstew1110, I somehow missed that you were having issues at compile time. Where are you experiencing the compile time errors? In Unity or Visual Studio?
    I'm not sure about the silver light thing. I don't think that is an option on HoloLens.

Sign In or Register to comment.