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"

UE4.20 FNavigationSystem::GetCurrent() not working

as per the 4.20 Release notes the navigation system was moved to a separate module and i have been following this

alt text

I added the NavigationSystem as a dependency and fixed the Include statements and as the notes say

World->GetNavigationSystem was renamed earlier i was using GetWorld()->GetNavigationSystem()->Build(); in my code so I replaced it with FNavigationSystem::GetCurrent(GetWorld())->Build() as seen below

alt text

But that gives me an error saying the UWorld* pointer is not an accepted argument I checked the function definition and it take UWorld* as an argument isn't the World Context Object pointer to the world ?

alt text

I am not able to build my project because of this can't even open the editor for the project

Thanks in advance

Product Version: UE 4.20
Tags:
420.png (85.4 kB)
420.png (18.1 kB)
420.png (14.7 kB)
more ▼

asked Jul 20 '18 at 08:47 PM in C++ Programming

avatar image

BLaZeKiLL
26 1 2 4

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

I got it working by using UnavigationSystemV1::GetNavigationSystem(GetWorld())->Build();

but I still don't understand why FNavigationSystem::GetCurrent() is not working it is what's recommended in the release notes can somebody shed some light on it

more ▼

answered Jul 21 '18 at 07:54 AM

avatar image

BLaZeKiLL
26 1 2 4

(comments are locked)
10|2000 characters needed characters left

This is the implementation for FNavigationSystem::GetCurrent()

 template<typename TNavSys>
     FORCEINLINE TNavSys* GetCurrent(UWorld* World)
     {
         return World ? Cast<TNavSys>(World->GetNavigationSystem()) : (TNavSys*)nullptr;
     }

As you can see it is a templated function.

Usage:

 UNavigationSystemV1* NavSystem = FNavigationSystem::GetCurrent<UNavigationSystemV1>(GetWorld());


It also has a world context object compatible implementation, so if you are calling it from an object which has a valid world you can use:

 UNavigationSystemV1* NavSystem = FNavigationSystem::GetCurrent<UNavigationSystemV1>(this);
more ▼

answered Aug 01 '18 at 01:33 AM

avatar image

Sveitar
968 7 22 26

(comments are locked)
10|2000 characters needed characters left
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