#Sorry not quite sure what is happening here?

1 messages · Page 1 of 1 (latest)

wispy sequoia
brave sequoia
#

?

wispy sequoia
#

What is the screenshot showing?

brave sequoia
#

it changes values of stamina and agility

#

my bad forgot to remove a y at end of agility

#

and it set stats

wispy sequoia
#

Sorry not sure I'm following, 'stamina' is not a float, it's a class

brave sequoia
#

...

#

but in ur code it was float

#

oh my bad

#

then you can

#

stamina.baseValue = stamin;
agility.basevalue = agilit;

wispy sequoia
#

yeah having to do those all manually is what I'm trying to avoid

brave sequoia
#

Now I understand what you trying to make xd

wispy sequoia
#

if I have 30 stats that's 30 lines of basically the same code, which seems unnecessary

brave sequoia
#

use arrays?

wispy sequoia
#

Yeah I'm trying to use a list, but accessing the value of the other class is the difficult bit

#

as I can't seem to link them

brave sequoia
#

you can use getcomponent tho

wispy sequoia
#

Not on a class, only on a monobehaviour

brave sequoia
#

GameObject.GetComponent

wispy sequoia
#

it's not a GO, it's a basic class

brave sequoia
#

no

#

you can import from class

#
public class GetComponentNonPerformantExample : MonoBehaviour
{
    void Start()
    {
        HingeJoint hinge = gameObject.GetComponent("HingeJoint") as HingeJoint;

        if (hinge != null)
            hinge.useSpring = false;
    }
}```
wispy sequoia
#

I can't getcomponent on something that isn't a component tho?

brave sequoia
#

oh

#

I don't know mate

#

but for me GetComponent works

#

for classes too

#

make your class not monobehaviour

#

this is helpful

#

oh

#

between

#

unity only work with components

#

I'm just beginner too but I try help others so I learn more

wispy sequoia
#

Yeah I think I'll have to make my own version of "get compoent" kind of thing

#

Thanks for your time tho, appreciated 🙂