Last active
March 26, 2022 11:46
-
-
Save emadkhezri/d8d08aae40c0b2696b1e8162709c4dbb to your computer and use it in GitHub Desktop.
This component disables game object on specific platforms
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
/// <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