CustomShapeButton
CustomShapeButton copied to clipboard
Engine crashes when using a texture with high resolution
So i was using the plugin and i had set all the textures correctly with the correct parameters but the engine kept crashing with this error:
[UnrealEditor CustomShape Button!SCustomShape Button::UpdateRawColors_Texture'::2'::<lambda_1>::operator()() [D:\UnrealProjects\CustomShapeButtonSample_UE5-4\Plugins\CustomShapeButton\Source\CustomShapeButton\Private\SCustomShapeButton.cpp:240] UnrealEditor_CustomShapeButton!UE::Core::Private::Function::TFunctionRefCaller<SCustomShapeButton::UpdateRawColors_Texture'::2'::<lambda_1>,void __cdecl(FRHICommandL]
After a lot of testing i have figured out that the problem was that the texture resolution was too high(1080x1080). I have fixed the issue by resizing the texture to 256x256. I figured i should post this in case someone else had the same issue with this plugin and also because this wasn't mentioned in the documentation.
Hello, I cannot reproduce your crash with this image of 4166x4164 size that I randomly found on the web:
- Video - where set up this 4k image from scratch for the Sample Project from Releases page
You can download this sample from the video with my 4k button and check if it crashes for you.
- Unreal Project from the video - Requires UE5.4. Unzip, then open
CustomShapeSample.uproject. - Cooked Game from the video - It's a shipped game, does not require Unreal Engine. Unzip, then open
CustomShapeSample.exe. (This link will be invalid soon).
If samples (both CookedGame and Project) don't crash for you, I suspect it might be something with your image setup. Then check next:
- Make sure the texture has proper settings. Refer to Step 3A from doc. A crash might occur if your heavy texture was unloaded by the engine to free up resources, so make sure 'Never Stream' is enabled.
- It would be worth verifying if the
Image Sizefrom theStylematches the actual texture size. Refer to Step 4B from doc. - If your image is corrupted or its size is not divisible by 2, the engine might crash. Try my 4k image from the video: link
Hey, thank you so much for the response, and sorry for taking so long to reply, but I was working on other parts of my project and I forgot about it.
I tried your suggestions and I found that one of my textures had 'Never stream' to false. Also, I didn't match the 'Image size' to my texture's resolution. The crash was pretty uncommon and it hasn't happened since.