You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SceneHelper.cs 1.0KB

1234567891011121314151617181920212223242526272829303132333435
  1. ///-----------------------------------------------------------------
  2. /// Namespace: <CozmoHelpers>
  3. /// Class: <SceneHelper>
  4. /// Description: <Used to deactivate specific objects that are only used in the sceneview not in the gameview>
  5. /// Author: <Tobias Hassel> Date: <29.07.2019>
  6. /// Notes: <>
  7. ///-----------------------------------------------------------------
  8. ///
  9. using System.Collections.Generic;
  10. using UnityEngine;
  11. namespace CozmoHelpers
  12. {
  13. public class SceneHelper : MonoBehaviour
  14. {
  15. [Tooltip("All the objects in this list will be deactivated/activated when the game is running")]
  16. public List<GameObject> toggleInPlayMode;
  17. public void Awake()
  18. {
  19. ToggleObjectList();
  20. }
  21. // Deactivate/Activate all gameObjects referenced in the toggleInPlayMode list
  22. private void ToggleObjectList()
  23. {
  24. foreach (GameObject go in toggleInPlayMode)
  25. {
  26. go.SetActive(!go.activeSelf);
  27. }
  28. }
  29. }
  30. }