Software Archive
Read-only legacy content
17061 Discussions

Fixing the 'FacialExpressionDetectedRule' RealSense crash bug in Unity 5.x

MartyG
Honored Contributor III
488 Views

Hi everyone,

In my project in Unity 5.2, I have been experiencing frequent, repeated crashes due to a conflict in the face tracking.  The error looks like this:

1.jpg

Although the error message lists numerous errors in its small print, investigation of the lines flagged up by each error in those specific scripts suggested to me that the main problem was in the 'FacialExpressionDetectedRule' script (located in the folder 'Assets > RSUnityToolkit > Internals > Rules') , and the rest were just errors that were caused by the problem in that script.

Despite the fact that it's a facial detection script, it almost always seems to be triggered when moving the hands around in a project that uses both hand and face tracking.  This suggests that it could be an issue with the camera losing / gaining tracking of the face as the hands are moved in front of the face.

The problem seemed to be centered around the block of code relating to the faceExpressionResult routine.

2.jpg

I replaced this entire section with a '}' bracket to cut it out and seal up the end of the code block.

3.jpg

After making this change, the crash bug could not be triggered again despite repeated testing.  So if you are experiencing the same bug, it may be worth giving this method a try in your own project.

If you later find that something has gone wrong and you need to get the original file back, you can re-import it into your project (overwriting the amended one) by running the Unity Toolkit application and un-ticking everything in the import window except the FacialExpressionDetectedRule file, then clicking the 'Import' button.

4.jpg

Best of luck!

0 Kudos
2 Replies
Xusheng_L_Intel
Employee
488 Views

Good catch and we will investigate the root cause and fix it in the future release. Thanks!

0 Kudos
MartyG
Honored Contributor III
488 Views

Thank you very much, David!   ^_^

0 Kudos
Reply