Crash in Unreal Engine (not using SL plugins)

In my case I only want to track a head so I’ve mad my own plugin.

It inherits from AActor and everything seems to be ok until I try to read the body list like
const sl::BodyData first_object = detected_bodies.body_list[0];

Notice that I can read and print detected_bodies.body_list.size() without problems, even I can read the properties of first_object but it crashes once first_object is freed.

Also I managed it to work by using
const sl::BodyData *first_object = &detected_bodies.body_list[0];

But I cannot understand the reason under the hood for that, so my questions are:

  • Is there any ‘best practices’ guide?
  • Is there any deeper explanation about using these types?


Hi @FrankEscobar

Did you make your plugin using the same architecture as we did, using the C wrapper?
This is a necessary constraint, due to compatibility issues between Unreal and the stdlib.

It could be the underlying reason for the crash.

Please give more details on your implementation and the crash log and call stack.
I’ll add that building and running from Visual Studio with the debugger can give you more info, on where the crash happens, and allow you to use breakpoints in your implementation to search on your side.


We won’t be able to help much if you’re not using the official plugin, sorry.