Skip to content

Instantly share code, notes, and snippets.

@blackbret94
Created September 25, 2019 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blackbret94/987a60af912494bbde08cf497c023957 to your computer and use it in GitHub Desktop.
Save blackbret94/987a60af912494bbde08cf497c023957 to your computer and use it in GitHub Desktop.
This is a very simple extension of MonoBehaviour I use in every Unity project. Every panel class in my games extend this class, allowing for a common interface across all panels.
using UnityEngine;
namespace Bretblack.Games.GUI
{
public class GamePanel : MonoBehaviour
{
public virtual void SetActive(bool b)
{
gameObject.SetActive(b);
}
public virtual void OpenPanel()
{
gameObject.SetActive(true);
}
public virtual void ClosePanel()
{
gameObject.SetActive(false);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment