Created
July 2, 2013 12:42
-
-
Save sfszh/5908956 to your computer and use it in GitHub Desktop.
if listened tab number is active the gameobject was enabled other wise disabled, use with tabController https://gist.github.com/sfszh/5908899
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
// this is a general tab listener | |
public class TabListener : MonoBehaviour { | |
public TabController tabController; | |
public int listenedTabNumber; // listenedTabNumber tabnumber | |
void TabHandler(int tabNumber) { | |
Debug.Log("number is " +tabNumber); | |
if (tabNumber != listenedTabNumber) { | |
gameObject.SetActive(false); | |
} | |
else { | |
gameObject.SetActive(true); | |
} | |
} | |
void Start () { | |
Debug.Log("Start" + listenedTabNumber); | |
tabController.onTabSelected += TabHandler; | |
gameObject.SetActive(false); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment