Assignment for RMIT Mixed Reality in 2020
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.

34 lines
704 B

  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. }