Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Adding to array

Discussion in '2D' started by Mrbazinga, Jun 5, 2024.

  1. Mrbazinga

    Mrbazinga

    Joined:
    Oct 27, 2022
    Posts:
    2
    I've been trying to add a gameobject to my array for some time now but have not got it working so instead I decided to make a function which removes all gameobjects in the array and then spawns them all in again but adding one more but for some reason it says that my length is 56 when its supposed to be 5
     

    Attached Files:

  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    8,647
  3. Mrbazinga

    Mrbazinga

    Joined:
    Oct 27, 2022
    Posts:
    2
  4. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    8,647
    What did you try and in what way didn't it work?

    It should be as simple as just calling
    .Add
    .
     
    DrDemencio and Kurt-Dekker like this.