Author Topic: isHosting not working?  (Read 3489 times)

Nightreaver

  • Guest
isHosting not working?
« on: February 11, 2013, 08:51:13 AM »
So, just a simple Setup

New Scene, imported TNet, added empty GameObject and attached that script to it.

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Test : MonoBehaviour {
  5.  
  6.         // Use this for initialization
  7.         void Start () {
  8.        
  9.         }
  10.        
  11.         // Update is called once per frame
  12.         void Update () {
  13.                 Debug.Log("Host:"+TNManager.isHosting);
  14.         }
  15. }

Why it is always returning "True"... regardless of whether there is any other TNet instance is in the scene, or any TNManager is in scene or anything else...
i cant get this value returning false... why? I think im doing it wrong!


Edith:

Okay... it is working... but only if isConnected.
Maybe it should return false, when its not connected to a server
« Last Edit: February 11, 2013, 12:29:15 PM by Nightreaver »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: isHosting not working?
« Reply #1 on: February 12, 2013, 09:18:44 AM »
You're still "hosting" the game if not connected -- hosting flag is for "am I controlling everything?" logic.

Nightreaver

  • Guest
Re: isHosting not working?
« Reply #2 on: February 13, 2013, 07:58:47 AM »
But then the Flag is true on every machine, isn't it?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: isHosting not working?
« Reply #3 on: February 13, 2013, 01:26:43 PM »
Only on the host, which is one player per channel.