Announcement

Collapse
No announcement yet.

UPROPERTY value keeps resetting on every compile

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

    UPROPERTY value keeps resetting on every compile

    I'm on 4.20.3.

    I have a property exposed in C++ as follows:

    UPROPERTY(EditDefaultsOnly)
    TSubclassOf<AProjectile> ProjectileBlueprint;

    This C++ class is inherited by a Blueprint class where I set this value to a AProjectile Blueprint class. The problem is this value resets to "None" every time I recompile, and I have to go into the Blueprint and set it again.

    I've tried fixing this multiple by recreating the variables, and components, using different tags, moving it to private/public, but it always resets on every compile even if nothing changed in code.

    Is this intended or am I doing something wrong?

    #2
    This does happen. After some research the general consensus seems to be that it won’t happen if you close the editor before compiling.

    Also, if i recall, this usually happens if your c++ class is derived from object.h

    Comment


      #3
      That is pretty much a "permanent bug".
      | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

      Comment


        #4
        I see. Does this happen for all versions of UE4? Seems to be a huge drag to be making sure I have the editor closed before compiling, and then having to reopen the editor again.

        Comment


          #5
          Yes.

          Also happens randomly with blueprint classes that are children of other blueprint classes, though no definite answer on what triggers that.

          I typically set my variables in a Data Table and initialize them in my construction script or onBeginPlay. It’s a real pain and semi-complicated process.

          Comment


            #6
            It's a known issue with TSubclassOf variables unfortunately. I raised this a while ago and it's been on the Issues forum since 4.17... *apparently* it's no longer occurring in 4.21

            https://issues.unrealengine.com/issue/UE-51994

            Feel free to bump this thread if needs be.
            https://forums.unrealengine.com/unre...uled-for-a-fix

            Comment


              #7
              The issue isn't specific to TSubclassOf. Whenever you change a header file while the editor is open, all exposed uproperties of the class revert to default.
              UE-52220 has been around for more than a year and it's first thing I look for with every update.
              I don't know how epic devs work without hotreload because it really destroys productivity.

              Comment


                #8
                Is there any way to disable hot reload or is that moot at this point? How has everyone been able to develop with this bug up to now?

                Seems like this is a workflow killer or a massive headache unless everyone is just avoiding exposing properties for blueprint totally.

                Comment


                  #9
                  Seems like it's pointer UPROPERTY()'s that get reset then - I haven't experienced much of that.

                  You wouldn't disable hot reload, you just have to restart the project from visual studio. My projects always open pretty quickly, and I haven't ever trusted hot reload anyway aside from making small CPP changes so I don't really feel the effects of it.

                  Live++ works relatively well and it's way faster. Only works so long as you don't make changes that require UHT to run though.

                  Comment


                    #10
                    What version are you on TheJamsh?

                    I'm actually also experiencing other non UPROPERTY values being reset like static meshs, and physics properties. It's such a time waster to have to hunt down reset values every time there's a recompile with the Editor running.

                    Comment


                      #11
                      4.19 / 4.20 here - but in all honesty I rarely ever use hot reload - only when I'm tweaking or fine-tuning properties. Half the time I find it's quicker to restart the project and load up a test map then wait for HR to finish :/

                      Comment


                        #12
                        Originally posted by TheJamsh View Post
                        Live++ works relatively well and it's way faster. Only works so long as you don't make changes that require UHT to run though.
                        What kind of iteration times do you get with Live++ ?

                        Comment


                          #13
                          Originally posted by TheJamsh View Post
                          It's a known issue with TSubclassOf variables unfortunately. I raised this a while ago and it's been on the Issues forum since 4.17... *apparently* it's no longer occurring in 4.21

                          https://issues.unrealengine.com/issue/UE-51994

                          Feel free to bump this thread if needs be.
                          https://forums.unrealengine.com/unre...uled-for-a-fix
                          This is still definitely happening as of 4.21.1 (Version: 4.21.1-4613538+++UE4+Release-4.21). All I need to do is close and re-open the editor and the TSubclassOf variable is reset to None, every time. It doesn't matter if I clean out binaries/intermediate, rebuild project files, etc. prior to opening the editor.

                          Comment


                            #14
                            Doesn't happen to me if I close and re-open the editor - but I have still seen it happen with Hot Reload.

                            If it's happening on close and re-open only then that's a new bug.

                            Comment


                              #15
                              Problem is still here unfortunately

                              Comment

                              Working...
                              X