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"

Why i have crash then i try spawn AActor from Thread?

GameInstance cpp:

             case 2001: //Object Spawn
             {

                 GI->SpawnObjects();

                 ZeroMemory(pocket, sizeof(pocket));
                 ZeroMemory(buff, sizeof(buff));

                 break;
             }

//Spawn scene objects function

             void UMyGameInstance::SpawnObjects()
             {
                 UWorld* const World = GetWorld();

                 if (World)
                 {
                    const FVector Location = FVector(240.0, -140.0, 148.0);
                    const FRotator Rotation = FRotator(0.0, 0.0, 90.0);

                    AGameObject* NewObject = World->SpawnActor<AGameObject>(AGameObject::StaticClass(), Location, Rotation);

                if (NewObject)
                {
                 GEngine->AddOnScreenDebugMessage(1, 10.0, FColor::Green, "blablabla", 0);
                }

                }
            }


Help me guys! i try to resolve this bug four days and no results( i launch the game and have the crash after 0-2 sec. On screen i saw spawned object, but recieve error window( alt text

if i copy spawn function code to another function, i have no error and game works well !

Product Version: UE 4.12
Tags:
screenshot_5.png (724.3 kB)
more ▼

asked Jun 05 '16 at 12:00 PM in C++ Programming

avatar image

exhum4n
7 2 2 3

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

1 answer: sort voted first

As i know you can't interact with UObjects from other threads. You would know that already if you checked logs (in Saved/Logs), if crash is due predicted error engine leaves message whats wrong there.

more ▼

answered Jun 05 '16 at 06:05 PM

avatar image

Shadowriver
37.3k 936 172 1117

(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