OVRAutoDestroyInMRC.cs 704 B

12345678910111213141516171819202122232425262728293031323334
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. // If there is a game object under the main camera which should not be cloned under Mixed Reality Capture,
  5. // attaching this component would auto destroy that after the MRC camera get cloned
  6. public class OVRAutoDestroyInMRC : MonoBehaviour {
  7. // Use this for initialization
  8. void Start () {
  9. bool underMrcCamera = false;
  10. Transform p = transform.parent;
  11. while (p != null)
  12. {
  13. if (p.gameObject.name.StartsWith("OculusMRC_"))
  14. {
  15. underMrcCamera = true;
  16. break;
  17. }
  18. p = p.parent;
  19. }
  20. if (underMrcCamera)
  21. {
  22. Destroy(gameObject);
  23. }
  24. }
  25. // Update is called once per frame
  26. void Update () {
  27. }
  28. }