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 = ();
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(
if i copy spawn function code to another function, i have no error and game works well !