# UE4每次打开都要重新编译着色器，怎么解决？The shader must be recompiled every time UE4 is opened, how to solve it?

**URL:** <https://forums.unrealengine.com/t/ue4-the-shader-must-be-recompiled-every-time-ue4-is-opened-how-to-solve-it/489923>\
**Category:** Rendering\
**Tags:** recompile, unreal-engine, Shaders, UE4, question\
**Created:** [October 16, 2021, 7:47am UTC](https://forums.unrealengine.com/t/ue4-the-shader-must-be-recompiled-every-time-ue4-is-opened-how-to-solve-it/489923 "2021-10-16T07:47:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![HeTuxb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HeTuxb](https://forums.unrealengine.com/u/HeTuxb)\
**Post date:** [October 16, 2021, 7:47am UTC](https://forums.unrealengine.com/t/ue4-the-shader-must-be-recompiled-every-time-ue4-is-opened-how-to-solve-it/489923/1 "2021-10-16T07:47:19Z")

</div>

删除了C:\Users\24033\AppData\Local\UnrealEngine\Common 目录下的全部内容，然后找到引擎的安装目录BaseEngine.ini文件用记事本打开它，然后搜索InstalledDerivedDataBackendGraph并找到%ENGINEVERSIONAGNOSTICUSERDIR%DerivedDataCache把它改为%GAMEDIR%DerivedDataCache，但是打开工程，完成着色器编译之后，关闭，之后再打开，还要重新编译着色器。  
Delete all the contents in the C:\Users\24033\AppData\Local\UnrealEngine\Common directory, then find the BaseEngine.ini file of the engine installation directory and open it with Notepad, then search InstalledDerivedDataBackendGraph and find %ENGINEVERSIONAGNOSTICUSERDIR%DerivedDataCache to change it It is %GAMEDIR%DerivedDataCache, but after opening the project and completing the shader compilation, close it, then open it again, and you need to recompile the shader.

知乎上找到一个和我问题描述一样的人，[https://www.zhihu.com/question/448803608](https://www.zhihu.com/question/448803608)

---

<div class="post-metadata">

**Author:** ![ydgros](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ydgros](https://forums.unrealengine.com/u/ydgros)\
**Post date:** [June 16, 2023, 3:28am UTC](https://forums.unrealengine.com/t/ue4-the-shader-must-be-recompiled-every-time-ue4-is-opened-how-to-solve-it/489923/3 "2023-06-16T03:28:50Z")

</div>

首先Epic Games\Launcher下的baseengine.ini和引擎的baseengine.ini缓存路径保持一致（这样只有第一次打开需要编译，后续不需要）  
可以用[InstalledDerivedDataBackendGraph]搜索  
将缓存路径改为下面第一个，是缓存到C盘（新建第一个项目需要编译，新建第二个项目不需要编译，适合电脑中只存在一个相同版本引擎，例如官方的5.1，还有一个源码的5.1，两者会冲突，导致每一次打开都需要编译），第二个是缓存到项目（新建每一个一个新的项目都需要编译着色器，适合电脑中存在多个相同版本引擎，例如官方的5.1，还有一个源码的5.1，由于缓存在项目中，两者不会冲突）  
%ENGINEVERSIONAGNOSTICUSERDIR%DerivedDataCache  
%ENGINEDIR%DerivedDataCache
