Skip to content

Instantly share code, notes, and snippets.

@sfszh
Created July 2, 2013 12:42
Show Gist options
  • Save sfszh/5908956 to your computer and use it in GitHub Desktop.
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
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