Hello so creating and adding a component to a actor at runtime was not that hard.
But i can not figuer out how remove a component at runtime.
All my searches turn up ::DestroyComponent() but that makes me crash the instant it`s called.
Can anyone tell the correct way of Removing a component from a actor at runtime?
Actually UnregisterComponent and DestroyComponent both works for me in Editor.
But recreating new component with the same name crashes editor. Any way to fix this?
Called Garbage Collector but it does not help a lot.
Dynamic components should be created using NewObject, are you using that function? In that case, you can give the spawned component no name or set it to NAME_None. You shouldn’t run into the issue then.
I have a question, hope you know the answer, I create new UStaticMeshComponents at runtime and place them in an TArray. They are registered and i can succesfully set a mesh and manipulate their placement right after creation. However, if i try to access the same TArray, which was declared in the header file, at another time, the array is empty… the meshes are still visible in the editor, but for some reason the TArray is empty? any clue??? tahnks a billion!