Destroying an Actor Referenced in an Array
I have an array of actors which i use for some purposes through out entire level. When I try to destroy an actor and remove it from the array, i get a crash saying Assertion Failed: IsInGameThread().
Here is the crash log: Crash Log
This is where debugging leads me to. If i just remove the line that says this->Destroy() everything becomes fine! I am not sure about what i am doing wrong. I hope someone can help me. Thanks in advance.
Here is PieceGotEaten function:
asked Jan 05 '17 at 07:40 AM in C++ Programming
if you are on another thread, then you are definitely hitting a race condition :) you must not manipulate renderable items outside of the main (render) thread. Try calling your code in something like this instead:
I might have spotted the issue, however i am not sure and would be happy if someone confirmed me.
It seems Unreal Engine has an assertion to make sure that no Actor would get destroyed by a class that exists in another thread.
In my case, i have a thread that runs another process. When that process gives signal, an event named BestMoveReceived is called and executes the above functions. I guess thats where the crash happens. It detects an actor is being deleted by a call from another thread and safety belt kicks in.
If there is such a thing in Unreal, then i need to search for other methods.
answered Jan 05 '17 at 10:33 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here