thedefside / BetterUI

Subtle UI mod for Valheim
BSD 2-Clause "Simplified" License
9 stars 9 forks source link

Error when enabling customfoodbar button in Config Manager #31

Closed simdo01 closed 1 year ago

simdo01 commented 1 year ago

Error when enabling customfoodbar button in config manager

[Error : Unity Log] NullReferenceException: Object reference not set to an instance of an object Stack trace: BetterUI.Patches.CustomElements+FoodBar.Update (Player player) (at :0) BetterUI.GameClasses.BetterHud.UpdateFood (Player player) (at :0) (wrapper dynamic-method) Hud.DMD(Hud,Player) (wrapper dynamic-method) Hud.DMD(Hud)

thedefside commented 1 year ago

Thank you for the report. It might take me a couple days to get to it.

Goldenrevolver commented 1 year ago

all four custom bar elements really don't like it when you change the config ingame since they only get created in Awake, so they all throw null reference exceptions if you enable or disable them at the wrong time (the food bar throws different ones than the health and stamina bar though). Getting all the null references out of the way is not difficult of course, but would loading them at run time be worth the work?

edit: okay, food bar simply throws different ones because it's the only one not doing everything in a try catch block :) edit: making good progress, I will send a pull request soon