Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Question How to fetch transform points after spawning?

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

  1. hrohibil


    Apr 17, 2021
    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


    Feb 11, 2021
    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.