Color changer not working

I set the firing status to one which contains another color yet I am given the default color and i’m not sure why.

I keep getting this error:
LogScript:Warning: Accessed None trying to read property BP Aiming Comp. Reference
PlayerCrosshair_C /Engine/Transient.UnrealEdEngine_0:GameInstance_4.PlayerCrosshair_C_18
Function /Game/Widgets/PlayerCrosshair.PlayerCrosshair_C:Get_Crosshair_x_ColorAndOpacity_0:01A2

Thank you in advance if anyone else knows why this is occuring!

Translating this error message
“Accessed None trying to read property BP Aiming Comp. Reference
PlayerCrosshair_C /Engine/Transient.UnrealEdEngine_0:GameInstance_4.PlayerCrosshair_C_18
Function /Game/Widgets/PlayerCrosshair.PlayerCrosshair_C:Get_Crosshair_x_ColorAndOpacity_0:01A2”

Null reference when trying to read BP Aiming Comp. Reference in PlayerCrosshair blueprint in the function Get_Crosshair_x_ColorAndOpacity

Basically you didn’t set the AimingComponent reference. Ben has it set during the creation of the PlayerUI widget in the TankPlayerController blueprint

I’m still getting the same issue with the colour not changing but i’m no longer getting the error message, this is what I have so far but it goes to the first option in the select bp and uses that colour:

Do you have your project on github?

1 Like

This is my github folder, if you need me to dive more specifically into another file let me know

I greatly appreciate your help

Your problem is the spaghetti (no offense) you made in the Tank blueprint. If you remove all of the stuff that’s creating widgets and adding them to the viewport and only doing so in the TankPlayerController, it should work.

Also why do you have 3 widgets? The crosshair, reloading and health can all be part of one UI Widget. Using the bindings like “Get_Crosshair_x_ColorAndOpacity_0” to set values.

1 Like

the spaghetti and other widgets are things I was just testing out, I will remove them all soon and see if it all works also I didn’t know about bindings until this video, I will let you know how it goes and I thank you in advance if it all works out :slight_smile:

I found the issue it was me trying to add the crosshair twice, Thank you for pointing it out, the rest of it though is a mess and still needs to be cleaned up, honestly thank you so much for finding that problem, I need to keep a better lookout for that stuff

No problem :slight_smile:

1 Like

I cant seem to figure out how to fix it, i have the same issue.

Privacy & Terms