Search Unity

Question How to fetch transform points after spawning?

Discussion in 'Scripting' started by hrohibil, Sep 27, 2022.

  1. hrohibil

    hrohibil

    Joined:
    Apr 17, 2021
    Posts:
    280
    Hello chaps

    Sorry for this questioin.

    I Use A* pathfinding asset.

    It works good, but as I use a spawning system I can´t figure a way to fetch my transform points used for patrol after they spawn?

    The below code is part of the assst, where i can put in an array of transforms. It works great if my enemies don't spawn..


    Code (CSharp):
    1. /// <summary>Target points to move to in order</summary>
    2.         public Transform[] targets;
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,851
    You should give whatever is spawning these enemies a reference to your spawn points, or whatever is holding onto these points.

    Instantiate them, pass through the collection.
     
    Kurt-Dekker likes this.