using UnityEngine; public class SetActiveOnEditor : MonoBehaviour { public Component[] components; public GameObject[] gameObjects; public bool activeOnEditor = true; void Start() { #if UNITY_EDITOR foreach(var component in components) { component.gameObject.SetActive(activeOnEditor); } foreach(var gameObject in gameObjects) { gameObject.SetActive(activeOnEditor); } #else foreach(var component in components) { component.gameObject.SetActive(!activeOnEditor); } foreach(var gameObject in gameObjects) { gameObject.SetActive(!activeOnEditor); } #endif } }