Search Unity

shuffle list with gameobjects

Discussion in 'Scripting' started by Vi-V-eK, May 7, 2019.

  1. Vi-V-eK

    Vi-V-eK

    Joined:
    Jun 9, 2017
    Posts:
    11
    Hey guys a little help.
    I have list "public List<Transform> objectsParent1;" and i have 6-7 gameobjects in that list.
    i am using the positions of game objects and I want to shuffle them and store them in other list.
    "public List<Transform> shuffeledParent1;"

    now every time I shuffle I need to have my gameobjects at different positions.
    So if any help is provided that would be appreciated.
     
  2. dontdiedevelop

    dontdiedevelop

    Joined:
    Sep 18, 2018
    Posts:
    68
    you need to shuffle all this list(indexes) or shuffle the positions not indexes?
     
  3. Vi-V-eK

    Vi-V-eK

    Joined:
    Jun 9, 2017
    Posts:
    11
    basically i want to swap the positions of all the game objects present in my list