UStaticMeshComponent->SetCollisionEnabled Access Violation (nullptr)
I have a Pawn with a UStaticMeshComponent and when the player presses a button, the collision and visibility states of this mesh are toggled. However, after 60 seconds the engine crashes on
Am I missing something or is this a bug? Thanks!
Relevant code (using generic names):
I should also add that using
Turned out this was one of those problems that are caused by something else entirely and through debugging it, you discover and fix the root problem. The problem seemed to be the way I was creating my components in the Pawn's constructor. I was calling
answered Mar 09 '16 at 02:21 PM
short version: I was using a BP made from a C++ class. Calling
long version: In case it helps someone, a related problem I had was with a C++ actor class that would randomly crash and had strange behavior. I was creating a root component and 2 subcomponents, and the editor would randomly show more components with different names, and the visual representation it showed in the editor looked like something cached from long ago, and would still show that way even after cleaning out my project (deleting the dir and pulling from git and regenerating files).
In the C++ class, I can toggle visibility of subcomponents, and doing that crashed just like the above. Adding more fields, or changing the order of the fields in the .h file would seem to change the behavior.
But deleting any BP_MyClass in my levels/maps (but not actually deleting BP_MyClass itself) and directly using MyClass in levels/maps fixed the Access violations, other random crashes, huge performance lag when spawning actors, and some other oddities. And also removing casts to BP_MyClass in my blueprints fixed other problems and things I found weird (like it was calling the constructor 4 times, but now only 2 times for one object (but
And I was never using
answered Jan 15 '18 at 09:06 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here