Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question [SOLVED] List type variable changes type during run time.

Discussion in 'Visual Scripting' started by SkullKing, Dec 5, 2021.

  1. SkullKing

    SkullKing

    Joined:
    May 31, 2012
    Posts:
    40
    I have an object variable whose type is "list of Game Objects".

    I add objects without problems. However if I remove objects until there is only one element the variable type changes to "Game Object" and then all my list logic breaks because the variable is no longer a list (e.g.: I can´t add more Objects to the list)

    How can I avoid this?
     
  2. Show us your script, something is not right, there is no such thing as "changes type" just like that.
     
  3. SkullKing

    SkullKing

    Joined:
    May 31, 2012
    Posts:
    40
    Thanks for your reply.

    It was just a dumb mistake I was far too tired and sleep to code yesterday. Turn out when I was leaving the list with only one game object I was actually setting it´s value as another variable that was type "game object" and that caused the change.