void ANavigationData::PostInitProperties()
{
	Super::PostInitProperties();

	if (IsPendingKill() == true)
	{
		return;
	}

	if (HasAnyFlags(RF_ClassDefaultObject))
	{
		if (RuntimeGeneration == ERuntimeGenerationType::LegacyGeneration)
		{
			RuntimeGeneration = bRebuildAtRuntime_DEPRECATED ? ERuntimeGenerationType::Dynamic : ERuntimeGenerationType::Static;
		}
	}
	else
	{
		bNetLoadOnClient = (*GEngine->NavigationSystemClass != nullptr) && (GEngine->NavigationSystemClass->GetDefaultObject<UNavigationSystem>()->ShouldLoadNavigationOnClient(this));

		UWorld* WorldOuter = GetWorld();
		
		if (WorldOuter != NULL && WorldOuter->GetNavigationSystem() != NULL)
		{
			WorldOuter->GetNavigationSystem()->RequestRegistration(this);
		}

		RenderingComp = ConstructRenderingComponent();
	}
}
void ANavigationData::Destroyed()
{
	UWorld* WorldOuter = GetWorld();

	bRegistered = false;
	if (WorldOuter != NULL && WorldOuter->GetNavigationSystem() != NULL)
	{
		WorldOuter->GetNavigationSystem()->UnregisterNavData(this);
	}

	CleanUp();

	Super::Destroyed();
}
void ANavigationData::PostEditUndo()
{
	Super::PostEditUndo();

	UWorld* WorldOuter = GetWorld();
	if (WorldOuter != NULL && WorldOuter->GetNavigationSystem() != NULL)
	{
		if (IsPendingKillPending())
		{
			WorldOuter->GetNavigationSystem()->UnregisterNavData(this);
		}
		else
		{
			WorldOuter->GetNavigationSystem()->RequestRegistration(this);
		}
	}
}
void UFunctionalTestingManager::TriggerFirstValidTest()
{
	UWorld* World = GetWorld();
	bIsRunning = World != NULL && World->GetNavigationSystem() != NULL;

	if (bInitialDelayApplied == true && (bWaitForNavigationBuildFinish == false || UNavigationSystem::IsNavigationBeingBuilt(World) == false))
	{
		bIsRunning = RunFirstValidTest();
		if (bIsRunning == false)
		{
			AllTestsDone();
		}
	}
	else
	{
		bInitialDelayApplied = true;
		static const float WaitingTime = 0.25f;
		World->GetTimerManager().SetTimer(this, &UFunctionalTestingManager::TriggerFirstValidTest, WaitingTime);
	}
}
PyObject *py_ue_simple_move_to_location(ue_PyUObject *self, PyObject * args) {

	ue_py_check(self);

	FVector vec;
	if (!py_ue_vector_arg(args, vec))
		return NULL;

	UWorld *world = ue_get_uworld(self);
	if (!world)
		return PyErr_Format(PyExc_Exception, "unable to retrieve UWorld from uobject");

	APawn *pawn = nullptr;

	if (self->ue_object->IsA<APawn>()) {
		pawn = (APawn *)self->ue_object;
	}
	else if (self->ue_object->IsA<UActorComponent>()) {
		UActorComponent *component = (UActorComponent *)self->ue_object;
		AActor *actor = component->GetOwner();
		if (actor) {
			if (actor->IsA<APawn>()) {
				pawn = (APawn *)actor;
			}
		}
	}

	if (!pawn)
		return PyErr_Format(PyExc_Exception, "uobject is not a pawn");

	AController *controller = pawn->GetController();
	if (!controller)
		return PyErr_Format(PyExc_Exception, "Pawn has no controller");

	world->GetNavigationSystem()->SimpleMoveToLocation(controller, vec);

	Py_INCREF(Py_None);
	return Py_None;
}