[Bug] ARFace script keeps adding empty gameObjects
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
Please log a bug at https://unity3d.com/unity/qa/bug-reporting .