Reply To: BattleManager Enemy target reference issue
Home › Forums › Books › Mastering Unity 2D Game Development › BattleManager Enemy target reference issue › Reply To: BattleManager Enemy target reference issue
well I find why my CommandBar dont diselect the weapon, and I make this on CommandBar script
void Update()
{
Vector2 position = Vector2.zero;
GameObject GO = GameObject.Find(“BattleManager”);
BattleManager BM = GO.GetComponent<BattleManager>();
if (BM.attacking == true)
{
if (BM.attacking != AuxPlayerAttacking)
{
ResetSelection(selectedButton);
AuxPlayerAttacking = BM.attacking;
}
}
if(anchor)
{
position = CalculateAnchorScreenPosition();
}
else
{
position = transform.position;
}
SetPosition(position.x, position.y);
}
but now diselected the button and on BattleManager are setting the weaponselected = null when back to the player control BUT! on second turn I cant select any button O.x