Download

I Spawn a character, but l can't use NavigationSystem to control it to move to other location!help m

I Spawned a character, but l can’t use NavigationSystem to control it to move to other location!help me.i have spend a week to solve this question,i was crazing.
this is my code


AMyCharacter* SpawnedCharacter =
				World->SpawnActor<AMyCharacter>(WhatToSpawn, SpawnLocation, SpawnRotation, SpawnParams);
			UE_LOG(LogClass, Log, TEXT("**********************62"));

			UNavigationSystem* const NavSys = GetWorld()->GetNavigationSystem();
			if (NavSys)
			{
				UE_LOG(LogClass, Log, TEXT("**********************NavSys"));
			}

			FVector SpawnLocation1;
			SpawnLocation1.X = -780.0f;
			SpawnLocation1.Y = 390.0f;
			SpawnLocation1.Z = 112.0f;
			NavSys->SimpleMoveToLocation(SpawnedCharacter->GetController(), SpawnLocation1);

i also defined a controller to possess the character.


AMyPlayerController* SpawnedController =
			 				World->SpawnActor<AMyPlayerController>(WhatToSpawn, SpawnLocation, SpawnRotation, SpawnParams);
			 SpawnedController->Possess(SpawnedCharacter);

however, i find useless.in the scean, spawn couldn’t move.

If you open the output log are there any errors? SimpleMoveToLocation will throw some messages if you haven’t correctly setup you character. I suspect you are missing a path following movement component on your player controller.

是不是还需要设置AIController??