how to check compiling shaders finished by blueprint or c++

ues Editor Utility Widget
When importing the model, the compiler always compiles the shaders automatically. Can I get a certain return value after the completion of the compilation of the shaders, which is convenient for me to continue the follow-up work

so,how to check compiling shaders finished by blueprint or c++?

thanks

You can get that using c++. There are couple of functions available. such as

GShaderCompilingManager->FinishAllCompilation();
GShaderCompilingManager->IsCompiling()    

There are more useful functions you can get from that class.
And you have to include

#include "ShaderCompiler.h"

Thanks.

3 Likes

Can confirm this still works in 4.26.1 - Thanks for the tip!

Set this up for my project. Works fine / perfect in editor, standalone and launch game.
But in the packaged build it crashes. Any ideas / help much appreciated.

for clarity heres my function

UFUNCTION(BlueprintCallable, Category = “Shaders”)
static bool IsShadersCompiling();

bool UCPPFunctions::IsShadersCompiling() {
return GShaderCompilingManager->IsCompiling();
}

Maybe try instead:

FAssetCompilingManager::Get().FinishAllCompilation();

not sure i follow. the whole fasset part. Im pretty decent at C++ but occaisionally stuff like this make me realize i dont know jack.

The GShaderCompile bit makes sense to me as its the reference in the shaderComile.h to the class with the function.

I tried using GetNumRemainingJobs, since isCompiling returns an or statement 4 different elements, where as num jobs only does 2. but it crashed too

Are you saying its something to do with the → ( pointer right ? )

FAssetCompilingManager is a layer above the GShaderCompilerManager (has a list of IAssetCompilingManager - which is what FShaderCompilingManager is derived from).

I was thinking it may be that GShaderCompilingManager is a nullptr?

Using FAssetCompilingManager will hopefully have that list of managers mantained in a shipping build.

more or less follow. I see the connection from gshader to fshader but wasnt able to find the fassetcompilingmanager to go digging through it

Oddly enough if i just locally save isCompiling to a bool it runs. but if i try to use that bool as the output back to crashing… on second thought i wonder if it just didnt compile or something… more testing to verify

1 Like

maybe make the method non-static (just remove the static before the bool in the header)?

hmmm, good catch. I copy paste my headers all the time making new functions. Bad habit. and a static setting when not needed has bit me on the â– â– â–  before

testing

1 Like

fingers crossed, but nope still crashed

Thanks for trying to help out. Gotta shift gears now. Lost too much time to this today and now gotta refactor this out of the code… boooo.

Was stoked when i came across this as I was looking for something like this for awhile now. One of my problems to solve is rendering out icons, and not being able to tell if they re ready to have their picture taken. This wasnt perfect, but it was way better then a hardcoded delay

1 Like