MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Failed to attach BoundigBoxRig to gameobject during play mode on Dev_Working_Branch

Open decoc opened this issue 8 years ago • 3 comments

Overview

When attach BoundigBoxRig to a gameobject during play mode, an ArgumentException occurs. Because BoungingBox prefab couldn't find in Start();

private void Start()
        {
            objectToBound = this.gameObject;
            //Problem
            boxInstance = Instantiate(BoundingBoxPrefab) as BoundingBox;

Bounding box prefab is required to be assigned before play scene...

        [Header("Preset Components")]
        [SerializeField]
        [Tooltip("To visualize the object bounding box, drop the MixedRealityToolkit/UX/Prefabs/BoundingBoxes/BoundingBoxBasic.prefab here.")]
        private BoundingBox boundingBoxPrefab;

And the script doesn't retry to get BoundingBoxPrefab after the target is assigned in the runtime.

Steps to reproduce

  1. Start Play
  2. Create any object in scene
  3. Attach component of BoundignBoxRig to it.
  4. Error ArgumentException: The Object you want to instantiate is null. UnityEngine.Object.CheckNullArgument (System.Object arg, System.String message) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.cs:238) UnityEngine.Object.Instantiate[BoundingBox] (MixedRealityToolkit.UX.BoundingBoxes.BoundingBox original) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.cs:199) MixedRealityToolkit.UX.BoundingBoxes.BoundingBoxRig.Start () (at Assets/MixedRealityToolkit/UX/Scripts/BoundingBoxes/BoundingBoxRig.cs:174)

Unity Editor Version

Unity 2017.2.1.1p4

Mixed Reality Toolkit Release Version

2017.2.1p2 (Dev_Working_Branch)

decoc avatar Mar 11 '18 15:03 decoc

~~Fixed in #1820~~ It's not.

jshowacre avatar Mar 11 '18 16:03 jshowacre

The problems are same as 2017.2.1.4 RC. Both TwoHandManipulation and BoundingBoxRig require presetting BoundingBox. It cause error when add these componets while play scene because the componets try to refer BoundingBox on Start().

decoc avatar Apr 15 '18 23:04 decoc

Closing issues older than 180 days. If this is still an issue, please reactivate with recent information.

wiwei avatar Apr 11 '19 20:04 wiwei