- Home /
This question was
closed Oct 30, 2020 at 04:30 AM by
WhisperXD for the following reason:
The question is answered, right answer was accepted
how can get value from same script ??
i try long way to get value,
public Stats thisStats;
public Stats otherStats;
public int health;
public int defense;
public float damage;
public float power;
public bool skill1;
public bool skill2;
public bool skill3;
private void Update()
{
if (otherStats != null)
{
thisStats.health = otherStats.health;
thisStats.defense = otherStats.defense;
thisStats.damage = otherStats.damage;
thisStats.power = otherStats.power;
thisStats.skill1 = otherStats.skill1;
thisStats.skill2 = otherStats.skill2;
thisStats.skill3 = otherStats.skill3;
}
}
how to get value better way ?
Comment
Answer by frknerstr · Oct 28, 2020 at 12:32 PM
If you always equal the same values
thisStats = otherStats;
youcan use this.
yeah, i know what u meant, but that will get another script, what i want is just get value, so if otherStats is destroy, its gonna be ok,
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
A* Pathfinding on enemy to follow the player 0 Answers
How can i pick two randomly items from gameobject array ? 1 Answer
Where should I put this function? 2 Answers