x

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"

[4.9]SpawnActor called from Lib blueprint now crashes.

This code has always worked, now in 4.9 it crashes. Calling spawn actor from blueprint node inside a blueprint lib function. I don't see a world context pin or anything. Any suggestions?

UWorld* UEngine::GetWorldFromContextObject(const UObject* Object, const bool bChecked) const { if (!bChecked && Object == NULL) { return NULL; }

// Object is NULL, crashes here......

 check(Object);

 bool bSupported = true;
 UWorld* World = (bChecked ? Object->GetWorldChecked(bSupported) : Object->GetWorld());
 return (bSupported ? World : GWorld);

}

AActor* UGameplayStatics::BeginDeferredActorSpawnFromClass(UObject* WorldContextObject, TSubclassOf ActorClass, const FTransform& SpawnTransform, ESpawnActorCollisionHandlingMethod CollisionHandlingMethod, AActor* Owner) { AActor* NewActor = NULL;

 UClass* Class = *ActorClass;
 if (Class != NULL)
 {
     // If the WorldContextObject is a Pawn we will use that as the instigator.
     // Otherwise if the WorldContextObject is an Actor we will share its instigator.
     // If the value is set via the exposed parameter on SpawnNode it will be overwritten anyways, so this is safe to specify here
     APawn* AutoInstigator = Cast<APawn>(WorldContextObject);
     if (AutoInstigator == nullptr)
     {
         AActor* ContextActor = Cast<AActor>(WorldContextObject);
         if (ContextActor)
         {
             AutoInstigator = ContextActor->Instigator;
         }
     }

     UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject);
Product Version: UE 4.9
Tags:
more ▼

asked Sep 09 '15 at 05:09 AM in Bug Reports

avatar image

sgehrman
66 5 11 18

avatar image Doug E ♦♦ STAFF Sep 09 '15 at 05:42 PM

hey sgehrman-

Could you post the log files from the crash for additional information? In trying to reproduce this I created a blueprint function library function that calls SpawnActor and then set my character to call this function. Testing the call in game did not cause any crash for me. If you're able to reproduce the crash in a fresh project with no additional content please include the steps you took that led to the crash.

Cheers

Doug Wilson

avatar image sgehrman Sep 09 '15 at 09:39 PM

I found out how to reproduce it. I have two functions in my blueprint lib. The first one calls the second one. When calling the second lib blueprint node a world context pin was set to an actor, if I keep that null then it's OK, but if it's set to something it crashes. The second function calls spawn actor.

avatar image Doug E ♦♦ STAFF Sep 09 '15 at 09:43 PM

Could you add screenshots of how your blueprint function library is setup? What are the two functions being called doing? Where is the first function being called from? If you call the second function directly (without calling the first) does the crash still occur? Additionally, please include the log files in the projects Saved/Logs folder to provide more information on what exactly is failing when the crash occurs.

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

1 answer: sort voted first

Hi sgehrman,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.

more ▼

answered Sep 15 '15 at 02:38 PM

(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