BattleManager Enemy target reference issue

Home Forums Books Mastering Unity 2D Game Development BattleManager Enemy target reference issue

This topic contains 4 replies, has 2 voices, and was last updated by  Leonardo 1 year, 5 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #10483


    Hi, Mr Darkgenesis

    I have some problem with game reference on battle manager when I play first time is of player (don’t have ATB yet) I selection the weapon the target and push attack, the target die (I make stronger weapons to test), change control and go to enemy turn they attack and if the player dont die we go again (but this time we have weapon selected yet) we’ll select the target when the AttackTarget coroutine being the var lost all target reference on line 100 I don’t know why.

    there is my assets

    Mine BattleManager is so each differently I put all goblins on a private EnemyController[] globin; //I’ll change to enemy when all work xD
    have another things but is easy to note… but anything I have here

    please help  me =P


    Having a look now, sorry it took a while but I’m currently out of the country with work.

    My Initial thought, although I’ve not found it. Is that some state is not being cleared when the second attack starts.

    This is shown because the players weapon selection is not cleared between rounds, so I also suspect the selected enemy is not being cleared properly.

    Where it is getting stuck, is that is getting in a loop in the BattleManager update for the playerattack.

    Hope that helps, will look more again when I get a chance

    Simon (Darkside) Jackson



    <p style=”text-align: left;”>Omg all in time do what you need I still analizatng my code if I find the problem I tell here.</p>
    <p style=”text-align: left;”></p>
    <p style=”text-align: left;”>The for all.</p>



    Well I still look on that I close to make a solution and show here



    well I find why my CommandBar dont diselect the weapon, and I make this on CommandBar script


    void Update()


    Vector2 position =;

    GameObject GO = GameObject.Find(“BattleManager”);

    BattleManager BM = GO.GetComponent<BattleManager>();

    if (BM.attacking == true)


    if (BM.attacking != AuxPlayerAttacking)



    AuxPlayerAttacking = BM.attacking;





    position = CalculateAnchorScreenPosition();




    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

Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘Mastering Unity 2D Game Development’ is closed to new topics and replies.