Hot reload not working with version controlled dlls (Perforce)

Every time I build my custom code in c++, it never builds due to the dll file on from perforce, I have tried the P4VS extension installing, uninstalling, disable, enable, and I get the same results.
UnrealBuildTool : error : Unable to delete hot-reload file:

D:\Perforce\MyWorkSpace\ParentFolder\SubFolderDir\ProjectName\Binaries\Win64\UE4Editor-ProjectName_005-0006.dll

i deleted, the binaries, intermediate, and saved folders, this is the 3 project i created, but the 1st project to give me problems in recognizing the perforce.

Can I force UE4 to delete the hot reload files so i can compile my code?

Are your files binary files set to writable? Assuming you’re using P4V you can right click on the binaries, choose ‘change filetype’ and select the ‘w’ option to allow them to be writable rather than the standard perforce behaviour of making files read only.

Note that this does not automatically check out the files if a change does happen, so you might need to do that part manually when you’re ready to commit.

Another option is not to track the binaries in Perforce, you might not need them in there but depends on how you work with your team and your build process.

If you do need to track your binaries, you could also set how many versions are tracked within perforce in order to save space. You don’t really need to have all the versions as the binaries are easily built from code. You can set this from the ‘Change Filetype’ menu too.

@phil_me_up. This can help with some of the problems I been having. I am aware of setting all the file to have the read only flag unchecked. But,

This started happening in the team of 1 programmer and one artist. (I’m the programmer) I
I created a plugin that I upload to perforce how ever the custom required , the artist has no access to when they pull the latest plugin from perforce. When they opened the project, all updated code from within the plugin, that is used in blueprints are not found. Errors pop up saying that the node created (by the plugin) can not be found.

Is the process with a c++ project (the project the plugin in built in) and another project that is blueprint only, (the plugin is used in) the same as what you does described? I mean what should the artist pull if none of the VS(visual studio) files should not pushed?

In your setup, it sounds like you probably do want to submit the binary files to Perforce (in some situations you would just submit and have a CI/CD process to build the binaries from the committed files, then these are distributed to the team, but probably not in your case).

I’m currently working with a similar setup. My process is to make the changes, make sure that I’ve checked out all the binary files (for the game and plugins if appropriate - remember that even if your files are writable they are not automatically checked out), build from visual studio, test the changes are good and then commit.

In short, you should always compile in visual studio before committing - hot reload does, as you’ve seen, generate new dlls which the project then switches to using. You don’t ever want to commit these, only the ‘original’ files. I also find hot-reload to be problematic at times, so I try to use it as liittle as possible anyway.

Finally, the issue above where your artist is having errors popup is probably because you’re either not committing the changed dll’s, or your note compiling your changes in VS before committing.

TLDR: Hot reload is (usually) fine for testing your code changes quickly, but you will need to do a ‘final’ vs compile if you intend on submitting your binary files to perforce. The only files you should be submitting are the original binaries, not the ones ending in 001, 002 etc

Do I use a p4.ignore file to keep the 001,002 versions from committing?

That would be a good way. Personally I just made sure I never added those files to the repo. This allows me to checkout files en-mass, revert unchanged files and then commit just the modified binaries (if any)

Is it better to turn off hot reload then?

No. It’s still a good tool for faster iteration on bug fixes, but you should treat it as a ‘temporary’ build. Always close down Unreal and build in VS before you actually commit the changes. If the VS build fails then this is a problem you need to fix.

I would create a c++ plugin in a ue4 project. Choose what type . And then add the content and code. Once done drag and down the plugin folder into the new project for use. Is there a different way?

Right now I mostly install my plugins within my code base. It’s not necessarily the best way but it allows for faster iteration for me and we’re a single project studio at the minute so it makes sense. Each plugin is within the plugin folder as you’d expect and has all the build.cs files etc. This means that I can edit the code directly in the same VS project as the rest of my game code. Everything is still seperate (i.e. I treat a plugin as a plugin and don’t confuse dependencies), it’s just that this is more convinient for me. When I build, if a plugin has changed then the binary will be updated too, so I just need to check out that binary and commit the changes. Ocasionally I’ll have to rebuild the full solution.

As if the ue4 never sees updated code, even though the all the scripts are there with the changes.

That sounds like your binaries aren’t being built or committed. If you’re familair with the Unity engine then you might know that you can just change a C# script and Unity will just accept and build that on startup. In UE4 that’s not the case, you need to manually build to compile your changes and it’s the resulting binary files which the engine looks for, not the cpp/h files.

I always compile in VS but is only works for me in most cases.
I would compile and then and open the project in another workspace I check for changes, everything was the same but I still have the code missing in ue4. As if the ue4 never sees updated code, even though the all the scripts are there with the changes.

But when I compile in VS the changes from one script is not recognized but when I created a new script and add a debug. Ue4 immediately recognized it.

Is it better to turn off hot reload then?

You said a final compile in VS? What do you mean?
From how I understood it, I would create a c++ plugin in a ue4 project. Choose what type . And then add the content and code. Once done drag and down the plugin folder into the new project for use.
Is there a different way?
Do I use a p4.ignore file to keep the 001,002 versions from committing?

I tried what you had recommended, and it ‘broke’ my code.
i only checked out the original binaries of the plugin and removed the others
(i.e UE4Editor-PluginName-###.dll).

then when i only checked out the original binary, config, content, source, and uproject
(I did not check out intermediate, the VS sln, saved, .vs, )
i pulled the project and i was back at square one. Code is there, binaries were updated, but UE4 still does not recognize my . dll

this all started happening after i had a similar problem to this, i created a new project, added code on top of the code i already had, and it worked, the first time, the very next time i update the code the 2nd after the new project and that one script was created, i get all of these errors. :frowning:

could it be that the older files were corrupted?
should VS config be set up as development editor and Win 64?

OK, to clarify the situation (because I’m getting confused), is this what’s happening?

  1. You have a working project.
  2. You make some code changes and hot compile. Everything is fine.
  3. You close Unreal, compile in VS. Compile completes correctly, you open up UE4 and everything works as expected.
  4. You check in your code changes, asset changes and the modified binary files (including any plugin modifications).
  5. You (or someone else) grabs those changes in a different workspace and it doesn’t work?

Is this correct?

If this is the case and it’s still not working then maybe you should consider removing all binary files (for the game and plugins) and doing a complete clean followed by rebuild solution in VS, then check in those binaries.

Are you getting errors when building in Visual Studio (full rebuild solution)? If you are then can you put a copy here.

Are you able to make a build on the machine where you make your changes (Get to step 3 above and then package project). Does that work?

Maybe also try a ‘Mark for add’ on your Source folders (game and plugin) incase something isn’t added and UE4 is re-compiling on startup.

Sorry if it sounds like we’re going round in circles here but I’m struggling to see which part of the process the error is occurring. Could you write down step-by step what you’re doing ultimately if you’re binaries are properly built, checked out and committed then you shouldn’t have a problem.

the setup in visual studio was only half done, p4vs is enabled, workspaces have been removed in perforce and replaced a stream adn p4.ignore file, thank you for your help