Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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:

 FActorSpawnParameters SpawnInfo;
 SpawnInfo.bNoCollisionFail = true;
 Inventory = GetWorld()->SpawnActor<AInventory>(AInventory::StaticClass(), SpawnInfo);

That's giving me NULL. O also tried (don't know exactly what this does, saw it online):

 Inventory = AInventory::StaticClass()->GetDefaultObject<AInventory>();

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.

Product Version: Not Selected
more ▼

asked May 13 '14 at 09:54 PM in C++ Programming

avatar image

6k 161 129 304

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered May 13 '14 at 11:37 PM

avatar image

[Epic]Ben Zeigler STAFF
1.3k 29 131 75

avatar image xlar8or May 14 '14 at 10:05 AM

Yes i agree that the bNoCollisionFail does not make much sense, since it's a non-physical actor. I will look into that and try to see what is happening and will comment here when i know something. Thank you very much.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question