❔ Stats
I had a quick question. Is there a way to find a specific scriptable object? I'm working on stats system for a 2D project in Unity but currently when I pickup a stat it adds all of their modifiers regardless if its the right stat or not.
I'm using a Event which sends the objectName on pickup to this function
13 Replies
$xy
The XY Problem
Asking about your attempted solution rather than your actual problem
The solution I'm looking to achieve is if I pickup say the Health Buff it only get's the Health Buffs modifyAmount rather than another stats amount.
Your current snippet doesn't show what's going wrong
Does this help?
Not really.
You're basically suggesting
if
is brokenSo basically, if I pick up the Damage Buff stat it also adds its modify amount to the maxHealth.
I'm trying to figure out a way to separate the two so when I pick up the Damage Buff it does not also add that amount to the maxHealth.
Sorry I suck at explaining things
So are you showing code that doesn't work, or an idea you think might work?
That doesn't work at the moment
What you're showing can't be the problem
(on its own)
Quick thing, have you tried printing out the objectName to console right before the if statements to be sure they actually match? Is the specific issue that the if statements aren't being triggered right now?
Yes, I've done that. Umm.... really weird I restarted the editor and um... it seems to be working as intended
Before it would add the Damage buff to the players health for some reason but uhhh not anymore I guess....
Lol nothing changed from the code I don’t understand what caused the issue but 🤷
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.