Announcement

Collapse
No announcement yet.

C++ Transition Guide for 4.21

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    C++ Transition Guide for 4.21

    Dear Community,

    This is the thread where you can post all your questions and solutions as you upgrade your project to 4.21!

    ~~~

    error C2039: 'GetPhysXScene': is not a member of 'FPhysScene_PhysX'

    Code:
    PxScene* PScene = PhysScene->GetPhysXScene(PST_Sync);
    becomes

    Code:
    PxScene* PScene = PhysScene->GetPxScene(PST_Sync);
    ~~~

    'GetPxRigidActor_AssumesLocked': is not a member of 'FBodyInstance' error.

    Code:
    PxRigidActor* PRigidActor = Body->GetPxRigidActor_AssumesLocked();
    becomes

    Code:
    #if WITH_PHYSX && PHYSICS_INTERFACE_PHYSX
        PxRigidActor* PRigidActor = FPhysicsInterface::GetPxRigidActor_AssumesLocked(BodyInstance->GetPhysicsActorHandle());
    #endif
    ~~~

    Enjoy!



    Rama
    Last edited by Rama; 11-08-2018, 11:01 PM.
    100+ UE4 C++ Tutorials on the UE4 Code Wiki, including UE4 Multi-Threading!

    UE4 Marketplace: Melee Weapon Plugin & Compressed Binary Save System Plugin | Rama's C++ AI Jumping Videos | Vertex Snap Editor Plugin

    Visit www.ue4code.com to see lots of videos about my C++ Creations! ♥ Rama

    #2
    **.Build.cs : warning : Modules must specify an explicit precompiled header (eg. PrivatePCHHeaderFile = "Public/OpenExrWrapper.h") from UE 4.21 onwards.
    Example:
    Code:
    // Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
    
    namespace UnrealBuildTool.Rules
    {
        public class OpenExrWrapper : ModuleRules
        {
            public OpenExrWrapper(ReadOnlyTargetRules Target) : base(Target)
            {
                bEnableExceptions = true;
    
                PCHUsage = ModuleRules.PCHUsageMode.NoSharedPCHs;
    PrivatePCHHeaderFile = "Public/OpenExrWrapper.h";
    
                bUseRTTI = true;
    
                PublicDependencyModuleNames.AddRange(
                    new string[] {
                        "Core",
                        "TimeManagement",
                    });
    
                bool bLinuxEnabled = Target.Platform == UnrealTargetPlatform.Linux && Target.Architecture.StartsWith("x86_64");
    
                if ((Target.Platform == UnrealTargetPlatform.Win64) ||
                    (Target.Platform == UnrealTargetPlatform.Win32) ||
                    (Target.Platform == UnrealTargetPlatform.Mac) ||
                    bLinuxEnabled)
                {
                    AddEngineThirdPartyPrivateStaticDependencies(Target, "UEOpenExr");
                    AddEngineThirdPartyPrivateStaticDependencies(Target, "zlib");
                }
                else
                {
                    System.Console.WriteLine("OpenExrWrapper does not supported this platform");
                }
    
                PrivateIncludePaths.Add("OpenExrWrapper/Private");
            }
        }
    }
    | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

    Comment


      #3
      Anyone running into this?

      After switching to 4.21, git status always give this:
      Code:
      Untracked files:
      (use "git add <file>..." to include in what will be committed)
      IOS/IOSTargetPlatform/Private/IOSTargetDeviceOutput.h
      IOS/IOSTargetPlatform/Private/IOSTargetDeviceOutput.inl
      But if I delete the files manually it gives:

      Code:
      Changes not staged for commit:
        (use "git add/rm <file>..." to update what will be committed)
        (use "git checkout -- <file>..." to discard changes in working directory) deleted:
          iOS/IOSTargetPlatform/Private/IOSTargetDeviceOutput.h deleted:
          iOS/IOSTargetPlatform/Private/IOSTargetDeviceOutput.inl
      it seems they are both tracked and not tracked?

      Looking at 4.21 git log of the files, it seems those two files were deleted and re-added due to some kind of case sensitivity issue, and you can see the folder goes from IOS to iOS in the status messages. On my system it is IOS, but on github it is listed as IOS too. If I change it to iOS I instead start getting:

      Code:
      Untracked files:
        (use "git add <file>..." to include in what will be committed)
      
              iOS/IOSPlatformEditor/
              iOS/IOSTargetPlatform/IOSTargetPlatform.Build.cs
              iOS/IOSTargetPlatform/Private/IOSDeviceHelper.h
              iOS/IOSTargetPlatform/Private/IOSTargetDevice.cpp
              iOS/IOSTargetPlatform/Private/IOSTargetDevice.h
              iOS/IOSTargetPlatform/Private/IOSTargetPlatform.cpp
              iOS/IOSTargetPlatform/Private/IOSTargetPlatform.h
              iOS/IOSTargetPlatform/Private/IOSTargetPlatformModule.cpp
              iOS/IOSTargetPlatform/Private/Mac/
              iOS/IOSTargetPlatform/Private/Windows/
              iOS/TVOSTargetPlatform/
      but it clears up the other two files..
      Last edited by muchcharles; 11-09-2018, 02:04 AM.

      Comment


        #4
        Since upgrading to 4.20 from 4.19, I have been having this issue with the steam dependency, has anyone else ran into this problem?

        Comment


          #5
          Trying to upgrade my toolkit for the market place and everything plays fine in the editor and standalone but now when I publish the example game it creates then i try to load a level pass the title screen and it just crashed with no real path as to what is wrong:


          Access violation - code c0000005 (first/second chance not available)

          RPGPluginTest!UObject::CallFunction()
          RPGPluginTest!UObject::execLetBool()
          RPGPluginTest!UObject::ProcessInternal()
          RPGPluginTest!UObject::CallFunction()
          RPGPluginTest!UObject::ProcessInternal()
          RPGPluginTest!UFunction::Invoke()
          RPGPluginTest!UObject::ProcessEvent()
          RPGPluginTest!AActor::ProcessEvent()
          RPGPluginTest!FLatentActionManager::TickLatentActionForObject()
          RPGPluginTest!FLatentActionManager::ProcessLatentActions()
          RPGPluginTest!AActor::Tick()
          RPGPluginTest!AActor::TickActor()
          RPGPluginTest!FActorTickFunction::ExecuteTick()
          RPGPluginTest!FTickFunctionTask:oTask()
          RPGPluginTest!TGraphTask<FTickFunctionTask>::ExecuteTask()
          RPGPluginTest!FNamedTaskThread::ProcessTasksNamedThread()
          RPGPluginTest!FNamedTaskThread::ProcessTasksUntilQuit()
          RPGPluginTest!FTickTaskSequencer::ReleaseTickGroup()
          RPGPluginTest!FTickTaskManager::RunTickGroup()
          RPGPluginTest!UWorld::RunTickGroup()
          RPGPluginTest!UWorld::Tick()
          RPGPluginTest!UGameEngine::Tick()
          RPGPluginTest!FEngineLoop::Tick()
          RPGPluginTest!GuardedMain()
          RPGPluginTest!GuardedMainWrapper()
          RPGPluginTest!WinMain()
          RPGPluginTest!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253]
          kernel32
          ntdll


          So far I've tried using the command line to compile just the plugin and its giving me errors about including object.h not being found. So far I've tried to change my build.cs from:

          bEnforceIWYU = true;
          PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

          to

          bEnforceIWYU = true;
          PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
          bEnableExceptions = true;

          PCHUsage = ModuleRules.PCHUsageMode.NoSharedPCHs;
          PrivatePCHHeaderFile = "Public/RPGEngineToolKit.h";

          and now it's asking me to remove every place i used minimal.h so maybe after all then IWYU changes ill finally be able to run my published build?

          Is there a place where they specify the c++ side of changes in new releases?

          12 CatBlack Studios - One man with a dream, to create amazing things...
          RPG Engine Toolkit: https://www.unrealengine.com/marketp...engine-toolkit
          Auto Terrain Cover V3: https://forums.unrealengine.com/show...ver-V3-Release
          Youtube: https://www.youtube.com/channel/UCuT...VDuzeIeJ6_j1pA
          Facebook: https://www.facebook.com/pages/12-Ca...52913014823124

          Comment


            #6
            Originally posted by looter View Post
            Since upgrading to 4.20 from 4.19, I have been having this issue with the steam dependency, has anyone else ran into this problem?
            I had the same issue and added these codes in GameInstance Construct.

            Code:
            if (!HasAnyFlags(RF_ClassDefaultObject))
            {
                FString RootSteamPath = FPaths::EngineDir() / STEAM_SDK_ROOT_PATH / STEAM_SDK_VER_PATH / TEXT("Win64/");
                FPlatformProcess::PushDllDirectory(*RootSteamPath);
            }
            Advanced Steam Plugin | UPNP Plugin | GameLift Plugin | Steam Inventory Plugin
            https://ue4plugin.wordpress.com/

            Comment


              #7
              Looks like PhysicX has trouble with seamless travel. crashed with PhysX3PROFILE_x64.dll and PhysX3_x64.dll.
              Anyone knows the best practice?

              PhysX3CHECKED_x64.dll is fine.
              Code:
              public ProjectTarget(TargetInfo Target) : base(Target)
              {
                  Type = TargetType.Game;
                  bUsesSteam = true;
                  bUseCheckedPhysXLibraries = true;
                  bUseShippingPhysXLibraries = false;
              Attached Files
              Last edited by WoodsShin; 11-13-2018, 05:29 PM.
              Advanced Steam Plugin | UPNP Plugin | GameLift Plugin | Steam Inventory Plugin
              https://ue4plugin.wordpress.com/

              Comment


                #8
                So I'm experiencing something rather odd, I transitioned a test project for 4.20 to 4.21 with no issues at all, So I went ahead and did the same thing with my main project. Now, all of my includes for anything to do with UE4 cannot be opened. Took some screenies of the problem at hand (I've used CoreMinimal as a focus point).

                It appears as if it no longer has the right path to any of the engine headers (2nd screenshot does not include the Public folder of Runtime/Core), all of these worked fine on 4.20, and continues to work fine if I change the engine type back. It also appears to change from using Community 2015 to Community 2017, not sure if this has something to do with it?

                Any help would be appreciated, I'd like to keep our project on the latest engine while it is still viable to do so.


                Comment


                  #9
                  If anyone else gets this problem (even though it was a really dumb error on my move), you may have to remove some plugins that do not work with 4.21 from your target.cs files.

                  Comment


                    #10
                    I've been having serious troubles to make UE4.21 work.
                    • Had to modify most of my build.cs files because all the relative paths were resolved using the engine's directory. I modified these .cs files replacing things like moduleName/public with Path.Combine(ModuleDirectory, "Public")
                    • Various properties became private and had to replace them with the new Getters (this is ok and pretty sensible thing to have regardless)
                    • Maybe it's just me but this whole private PCH thing is quite confusing. I know what a PCH is and what it does but the way unreal uses them and how it affects the compilation.. it's confusing. Why do I have to specify a PrivatePCHHeaderFile if I set PCHUsageMode.NoSharedPCHs?
                    • Now in my playerController::BeginPlay if I pass to some of my objects a pointer to the player controller it becomes STALE !
                    I've been updating the engine's source every release since 4.11 and this time I skipped 4.20 and went directly from 4.19 to 4.21.

                    Comment


                      #11
                      I updated to 4.21.1 and now all my destructible assets have gone crazy. There is a brick wall and when it breaks apart the bricks bounce all around like rubber balls. I have a monster trucks that fly's like a kit in a storm. How am i supposed to fix all of this

                      Comment


                        #12
                        Anybody got a fix for this one: error C2039: 'RigidActorSync': is not a member of 'FBodyInstance'

                        Code:
                            TArray<AActor*> Actors;
                            UGameplayStatics::GetAllActorsOfClass(GetWorld(), AStaticMeshActor::StaticClass(), Actors);
                        
                            for (AActor* Actor : Actors)
                            {
                                AStaticMeshActor* StaticActor = Cast<AStaticMeshActor>(Actor);
                                if (!StaticActor) continue;
                        
                                FBodyInstance* ActorBI = StaticActor->GetStaticMeshComponent()->GetBodyInstance();
                                if (!ActorBI) continue;
                        
                                PhysxActors.Add(ActorBI->RigidActorSync);
                                PxActor* PhysXActor = ActorBI->RigidActorSync;
                            }
                        Been trying to resolve this and haven't been able to.
                        Quinton Delpeche
                        Founder - Gobbo Games | Designer - The Colony 2174 (Board Game) | Developer - Riders of Asgard

                        Comment


                          #13
                          Originally posted by qdelpeche View Post
                          Anybody got a fix for this one: error C2039: 'RigidActorSync': is not a member of 'FBodyInstance'

                          Code:
                           TArray<AActor*> Actors;
                          UGameplayStatics::GetAllActorsOfClass(GetWorld(), AStaticMeshActor::StaticClass(), Actors);
                          
                          for (AActor* Actor : Actors)
                          {
                          AStaticMeshActor* StaticActor = Cast<AStaticMeshActor>(Actor);
                          if (!StaticActor) continue;
                          
                          FBodyInstance* ActorBI = StaticActor->GetStaticMeshComponent()->GetBodyInstance();
                          if (!ActorBI) continue;
                          
                          PhysxActors.Add(ActorBI->RigidActorSync);
                          PxActor* PhysXActor = ActorBI->RigidActorSync;
                          }
                          Been trying to resolve this and haven't been able to.
                          This:

                          Code:
                          PhysxActors.Add(ActorBI->RigidActorSync);
                          PxActor* PhysXActor = ActorBI->RigidActorSync;
                          Becomes:

                          Code:
                          PhysxActors.Add(FPhysicsInterface::GetPxRigidActor_AssumesLocked(ActorBI->GetPhysicsActorHandle()));
                          PxActor* PhysXActor = FPhysicsInterface::GetPxRigidActor_AssumesLocked(ActorBI->GetPhysicsActorHandle());
                          CTO | Head of VR Development - Visit us at http://humanxr.com
                          My UE4 Tutorials (mostly VR): https://goo.gl/GUvDyV

                          Comment


                            #14
                            Error " Expedition Contains illegal character '%' "

                            Comment


                              #15
                              Originally posted by Shaikh Mujahid View Post
                              Error " Expedition Contains illegal character '%' "
                              That's a bit too vague. What is the offending line of code?
                              CTO | Head of VR Development - Visit us at http://humanxr.com
                              My UE4 Tutorials (mostly VR): https://goo.gl/GUvDyV

                              Comment

                              Working...
                              X