How do you instantiate a notplacable actor?
I'm creating an NotPlacable Inventory class that derives from AActor and i want my custom ACharacter to have an instance of that class. Since it's an actor i tried to to spawn it on PostInitializeComponents() using:
That's giving me NULL. O also tried (don't know exactly what this does, saw it online):
But it's still giving me NULL. Do you know what i am doing wrong? I'm assuming that on Unreal Engine we're not supposed to instantiate AActor custom classes with new or mallocs, so i don't see other options other than the one's i've mentioned.
asked May 13 '14 at 09:54 PM in C++ Programming
Your code with SpawnActor is correct, but you shouldn't really need the bNoCollisionFail, we usually spawn those with just SpawnActor(Class). We do this all the time in fortnite. You generally want your non-physical actor to derive directly from AActor.
My guess is that something in your actor properties is stopping it from spawning, such as a physical component. You should step into SpawnActor and see why it's failing.
answered May 13 '14 at 11:37 PM
[Epic]Ben Zeigler STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here