Announcement

Collapse
No announcement yet.

C++ 4.16 Transition Guide

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

    C++ 4.16 Transition Guide

    Dear Community,

    Hiii everyone!

    4.16 C++ Coding party time!!

    This is a thread where you can share your research, solutions, and questions as you are upgrading to 4.16!

    If you have an issue that may not be entirely related to code but is clearly a 4.16 upgrade issue you can also post it here and see if anyone else has had a similar experience.

    Victory to Us!



    Rama
    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
    Thanks for starting one of these kind of threads again Rama!

    It seems some things got changed code wise for sequencer. Variable "tokens" in FMovieSceneTrackIdentifier turned private and FMovieSceneExecutionTokens::FEntry is now a private struct. Is there any way to still access these tokens and work with them? Would love to know to get FaceFx working on 4.16 as soon as possible

    Comment


      #3
      Not strictly C++ related, but I've just wasted a heap of time trying to track down why the Generate Project Files command is silently failing for some of my 4.16 projects.
      Turns out it's because of dependencies on plugins that are not yet installed for 4.16 (which makes sense and was the case with previous versions too) but changes to UBT in 4.16 seem to have resulted in the error dialog not being shown, so you just get a silent failure.

      So, for anyone experiencing the same issue, remember that the likely cause is plugin references inside your .uproject file. If you disable them there until the 4.16 plugin is available, you should be able to generate the project files.

      Comment


        #4
        I am getting this build error coming from 4.15.2 to 4.16. Module constructors should take a ReadOnlyTargetRules argument (rather than a TargetInfo argument) and pass it to the base class constructor from 4.15 onwards. However, I changed my project build.cs to have public Project(ReadOnlyTargetRules Target) : base(Target).

        Edit: Nevermind, it was found in a plugin i am using.
        Last edited by mkooner; 05-24-2017, 11:28 PM.

        Comment


          #5
          Hi guys,

          Finding FriendSessions now returns an array of FOnlineSessionSearchResult when using the FOnFindFriendSessionCompleteDelegate session delegate.

          Your callback function needs to change from

          OnFindFriendSessionsCompletedCallback(int32 LocalPlayerNum, bool bWasSuccessful, const FOnlineSessionSearchResult& SearchResult)
          ...to...
          OnFindFriendSessionsCompletedCallback(int32 LocalPlayerNum, bool bWasSuccessful, const TArray<FOnlineSessionSearchResult>& SearchResult)
          W3 Studios

          Comment


            #6
            Here's a couple of findings from me. I've switched my project to 4.16 a while ago so I might be missing some bits. GenerateProjectFiles.h will complain in any case.

            Code:
            public class MyGame : ModuleRules
            {
            
            
                public MyGame(ReadOnlyTargetRules ROTargetRules) : base(ROTargetRules) 
                {
                 }
            }
            This is how MyGame.Build.cs looks now.

            In MyGame.Target.cs, SetupBinaries() is no longer needed. Instead, in the constructor, below Type = TargetType.Game, you do this:

            ExtraModuleNames.AddRange(new string[] { "MyGame" });
            That ought to cover it.

            Comment


              #7
              Has anyone had any difficulty getting custom vars for Post Process showing up? My new variables in Scene.h don't seem to be appearing in the Details Panel. I suspect Post Process Volumes / Cameras now have a custom Detail Panel class, but I'm struggling to find it anywhere..

              Comment


                #8
                From the release notes:

                "The TargetRules.SetupBinaries() callback has been deprecated. Instead of overriding this, targets may override the launch module through the "LaunchModuleName" property in their constructor, and add extra modules to the "ExtraModuleNames" field on the TargetRules object itself."

                I'm having this deprecation warning but I can't seem to figure out how i should change it to the new standard:

                Code:
                public override void SetupBinaries(TargetInfo Target,
                		ref List<UEBuildBinaryConfiguration> OutBuildBinaryConfigurations,
                		ref List<string> OutExtraModuleNames)
                               	{
                		OutExtraModuleNames.Add("VR_Game");
                }
                Any suggestions?

                EDIT: Created a new 4.16 project and checked how it is generated and from there I found the correct way.

                From the above code I changed it to:

                Code:
                public VR_GameTarget(TargetInfo Target) : base(Target)
                {
                Type = TargetType.Editor;
                ExtraModuleNames.Add("VR_Game");
                }
                Last edited by Stratego99; 05-25-2017, 07:50 AM.

                Comment


                  #9
                  I was using an FStreamableManager property in GameInstance class to load assets dynamically. This seems to no longer work in 4.16. I get the following error.

                  Code:
                  UCLASS()
                  class CCAM_API UMainGameInstance : public UPlatformGameInstance
                  {
                  	GENERATED_BODY()
                  
                  public:
                  	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Data")
                  	UWeaponData* WeaponData = nullptr;
                  
                  	UPROPERTY(BlueprintReadOnly, Category = "Maps")
                  	FStreamableManager Assets;
                  };
                  Code:
                  C:/UEProjects/CCam/Source/CCam/GamePlay/MainGameInstance.h(23): error : Unrecognized type 'FStreamableManager' - type must be a UCLASS, USTRUCT or UENUM
                  This was working in 4.15. How do I fix this? Tried adding a header for StreamableManger no luck.
                  UE4 Tutorials for 3rd person Blueprint project from scratch: Youtube Channel
                  Use Blender 2.8 to make UE4 compatible animations: Blog

                  Comment


                    #10
                    Originally posted by Waves View Post
                    This was working in 4.15. How do I fix this? Tried adding a header for StreamableManger no luck.
                    Just remove the UPROPERTY line above it. It's no longer a reflected type, but since it had nothing exposed to blueprints anyway, this shouldn't have any effect on your project.

                    Comment


                      #11
                      How to fix such errors? FIOSystem was completely removed.

                      'GNewAsyncIO': undeclared identifier
                      'FIOSystem': is not a class or namespace name

                      Comment


                        #12
                        Hi, I have the following issue since upgrading my project to 4.16, using Visual C++ 2015: when the Unreal Editor is launched, the build from within Visual C++ (CTRL+SHIFT+B) fails with strange errors (see below). If I close the Unreal Editor then I can compile fine from Visual C++. I didn't have that problem with 4.15, I could build either from VC++ or Unreal when both were open.

                        Error (active) identifier "FDrawingPolicyRenderState" is undefined

                        e:\UE_4.16\Engine\Source\Runtime\Engine\Public\SceneManagement.h 1560
                        Error Failed to produce item: mygame-Win64-DebugGame.lib

                        Error MSB3075 The command "E:\UE_4.16\Engine\Build\BatchFiles\Build.bat mygame Win64 DebugGame "E:\Unreal Projects\mygame \mygame .uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.

                        Comment


                          #13
                          Hello everyone! It's already written, but I want to collect all in one heap and show you this visually.
                          How to transition your C ++ project from 4.15 to new features 4.16 and get rid of the warnings about of deprecated functions.

                          When RC is your project name:





                          Enjoy!)
                          Attached Files
                          Last edited by lKaptn; 05-29-2017, 01:06 AM.

                          Comment


                            #14
                            Could you or someone show the complete and working target.cs file? I can't get anything to work with 4.16, it only throws compile errors.

                            Edit: Well I've solved most critical errors, but whats up with this warning:

                            "Warning Module constructors should take a ReadOnlyTargetRules argument (rather than a TargetInfo argument) and pass it to the base class constructor from 4.15 onwards. Please update the method signature."

                            (every target file throws this warning)
                            Last edited by MADHOUSE; 05-25-2017, 02:13 PM.
                            ______________________________________________
                            https://www.facebook.com/madhousesoftware
                            Where sanity is a virtue

                            Comment


                              #15
                              TMaps with custom structs (as key) now need to explicitly implement GetTypeHash or supply custom key funcs for the struct. Previously it was sufficient if your parent struct implemented it, now it has to be defined for each struct it seems.

                              For reference here's a snippet from FGameplayTag:

                              Code:
                              /** Used so we can have a TMap of this struct */
                              FORCEINLINE friend uint32 GetTypeHash(const FGameplayTag& Tag)	{ return ::GetTypeHash(Tag.TagName); }
                              For reference (and easy googling!) here's the actual error: TMap must have a hashable KeyType unless a custom key func is provided.
                              Last edited by VSZ; 05-25-2017, 02:13 PM.

                              Steam Early Access: Drunk On Nectar - The Nature Simulator

                              UE4 Plugins: DoN’s Dynamic Mesh FX | DoN’s 3D Pathfinding

                              Comment

                              Working...
                              X