title: How to instantiate a : monobehaviour script from another GameObject
body: <p>I'm having trouble figuring this one out and am finding little on google that helps me.</p>
  
  <p>In unity, if a script derives from MonoBehaviour, it cannot be instantiated using the "new" keyword. Fine. So I've been looking at how to do this, and it seems that getting the GameObject, then getting it's GameComponent is the way to go... But it's not going very far..</p>
  
  <p>So I have a GameObject called NetworkManager. Attached to it is a script called NetworkManager. I have another GameObject called Main, attached to it is a script called Main (surprise!). Basically what I want to do is "instantiate" the network manager within the main script, so that i can do things like networkManager.hostServer() or networkManager.kickPlayer() and so on.</p>
  
  <p>This is my main.cs script:</p>
  
  <pre><code>public class Main : MonoBehaviour {
  
  Player player;
  GameObject networkManager;
  UiManager uiManager;
  
  // Use this for initialization
  void Start () 
  {
  
      player = new Player(Network.player, Environment.UserName, 0, 0);
      networkManager = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent&lt;NetworkManager&gt;();
      uiManager = new UiManager();
  
  }
  </code></pre>
  
  <p>The error I am getting is as follows:" Cannot implicitly convert type 'Assets.scripts.NetworkManager' to 'UnityEngine.GameObject' "</p>
  
  <p>The problem arises when I add the ".GetComponent();" part. Now it seems obvious that if the function is looking for a Component type and is instead getting a NetworkManager type that it wouldn't work... And that's where I'm stuck. I have no idea how to get this to work, and I've surpassed my 15 minute limit on google searching.</p>