arfoundation-samples icon indicating copy to clipboard operation
arfoundation-samples copied to clipboard

[Bug] ARFace script keeps adding empty gameObjects

Open AdrienMgm opened this issue 5 years ago • 1 comments

Hello,

We are working on a simulation tool to simulate face tracking (ARFace) in editor and we are facing an issue with the instantiation of new unreferenced gameObjects.

Describe the bug Each time an ARFace is added three new gameObjects are created in the scene and never destroyed even if the ARFace is destroyed by the ARFaceManager.

Below the code that creates the issue:

internal void UpdateEyes()
{
    if (leftEye == null && rightEye == null && fixationPoint == null)
    {
        leftEye = Instantiate(new GameObject(), transform).transform;
        rightEye = Instantiate(new GameObject(), transform).transform;
        fixationPoint = Instantiate(new GameObject(), transform).transform;
    }

    UpdateTransformFromPose(leftEye, sessionRelativeData.leftEyePose);
    UpdateTransformFromPose(rightEye, sessionRelativeData.rightEyePose);
    fixationPoint.localPosition = sessionRelativeData.fixationPoint;
}

As we can see in addition to instantiate a leftEye, rightEye and a fixationPoint we also create three unreferenced and empty new GameObject() so they are never destroyed.

Expected behavior Only instantiate needed objects and destroy them with an ARFace without leaving empty gameObjects in the scene.

Environment : Unity Editor 2019.4.24f1 ARFoundation 4.1.7 ARKit 4.1.7 ARCore 4.1.7

AdrienMgm avatar Jul 02 '21 15:07 AdrienMgm

Please log a bug at https://unity3d.com/unity/qa/bug-reporting .

todds-unity avatar Jul 27 '21 21:07 todds-unity