Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
3.07k stars 1.15k forks source link

Destroy region prefab if not face detected in scene #828

Closed moncio closed 3 years ago

moncio commented 3 years ago

Hi to everyone. I'm quite beginner using ArFoundation and ArCore. Right now I'm running the sample scene ARCoreFaceRegions.unity from branch 2.1 using Unity 2019.4.27f1. Openning the scene, I observe when there is no face detected, the attached prefab with the trackable face persists in the scene and I dont find the way to remove or hide or destroy this prefab when that happens. How can I do that?

Thanks in advance

tdmowrer commented 3 years ago

You can subscribe to the ARFaceManager's facesChanged event. When a face is not in the frame, it will either be in the list of removed faces, or its tracking state will change. See https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@4.1/manual/face-manager.html

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.