Skip to content

Instantly share code, notes, and snippets.

@emadkhezri
Last active March 26, 2022 11:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save emadkhezri/d8d08aae40c0b2696b1e8162709c4dbb to your computer and use it in GitHub Desktop.
Save emadkhezri/d8d08aae40c0b2696b1e8162709c4dbb to your computer and use it in GitHub Desktop.
This component disables game object on specific platforms
/// <summary>
/// Put this component on game objects that you wish to disable on specific platforms
/// </summary>
public class DisableOnPlatforms : MonoBehaviour {
[SerializeField]
[Tooltip("Selected Platforms to disable game object")]
private RuntimePlatform[] _platforms;
private void OnEnable() {
if (_platforms.Contains(Application.platform)) {
gameObject.SetActive(false);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment