C
C#8mo ago
Nadekai

❔ How to access variable from another class?

I wanna access int level from ability.cs to main.cs, but I have no idea how to do that.
{

public class Ability
{
public int level;


public class passiveAbility : Ability
{
public void Dodge()
{
level = 2;
}
}

public class activeAbility : Ability
{

}

}
}
{

public class Ability
{
public int level;


public class passiveAbility : Ability
{
public void Dodge()
{
level = 2;
}
}

public class activeAbility : Ability
{

}

}
}
2 Replies
Pobiega
Pobiega8mo ago
you'd do it via an Ability instance
Ability ability = new Ability();
ability.Level = 10;
Ability ability = new Ability();
ability.Level = 10;
Accord
Accord8mo ago
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.