GetComponent

how could i get bool called hpII from script called MushroomMove to another script?

-Thanks:)

Your other script just needs a reference to your MushroomMove script. There’s many ways to do that, but the typical way is to just expose the field in the inspector, then drag/drop its reference like usual:

public class OtherScript: MonoBehaviour {
  public MushroomMove mushroomMove;
}

From there, you can do whatever you want with that reference:

public class OtherScript: MonoBehaviour {
  public MushroomMove mushroomMove;

  void Start() {
    bool hpll = mushroomMove.hpll;
  }
}
1 Like