r/UnityHelp • • Oct 22 '22

Unity slider displaying different values

I have a game where you have a flashlight and a slider for fuel, when you run low on fuel you can pickup a canister to replenish 75f. The problem is that after you pickup the canister the slider displays the value before picking up when the flashlight is active. Any tips

here are all the instances of changing the slider value

3 Upvotes

3 comments sorted by

1

u/MasterCoconut22 Oct 24 '22

Update!

I somehow fixed it, I had a health slider that was working fine so I just copied the same thing and renamed some things and now its working perfectly.

1

u/LIFEHACKER008 Oct 23 '22

What is FeulBar.FeulBar. I mean a variable with the same name as that of the script. Have you checked debug. Log to see where you are able to reach in your code?

1

u/MasterCoconut22 Oct 23 '22

Its just a dumb looking way to look for another variable in different script, The thing itself works without errors. The thing is that when you pickup the fuelCanister the slider displays the value correctly but when the flashlight is active it displays the value befoe picking it up