Search Unity

I have a problem with a List

Discussion in 'Scripting' started by Riukensay, Jun 13, 2018.

  1. Riukensay

    Riukensay

    Joined:
    Jan 16, 2018
    Posts:
    49
    Hi everyone I hope they are well :)
    ok, I have a public List, wich I debug for console with .Count. In Update Method by console is show the size of my List(15) but when I try use foreach to roam this list this have a Size of 0 :( the stranger thing is that in console keeps sending 15 of .Count in Update Method. can someone help me with this?



    pd: Sorry for my bad english




    messages of "15" continue to be added to the console even after the 0 appears

    Thanks in advance
     

    Attached Files:

    • 1.png
      1.png
      File size:
      262.9 KB
      Views:
      730
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,500
    Picture is tiny.

    Update() doesn't run any of those methods, so that zero result is from some other time and the current result is still 15.

    Also, the getcomponent call to get the same component you're running it on is completely useless.
    this
    returns the same thing.
     
  3. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    And generally speaking. It's better to post your code using code tags and then explain what is happening and what you are trying to do.
     
  4. Riukensay

    Riukensay

    Joined:
    Jan 16, 2018
    Posts:
    49
    S.M I call buscarSlot() using a entercollision2d :) and again yes, the try of this.getcomponent is useless :/ now I get other screen shoot[/ICODE]
     
  5. Riukensay

    Riukensay

    Joined:
    Jan 16, 2018
    Posts:
    49
    okok sorry now I try this :)
     
  6. Riukensay

    Riukensay

    Joined:
    Jan 16, 2018
    Posts:
    49
    ok I find the error :eek: sorry :)

    Is there any way to delete this publication?