Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In Unity3D I am reading a textfile with information on nodes and its connections.

However it seems that ALL duplicates are removed automatically!

           for (int j = 0; j < tokens.Length; j++)
           {
               Debug.Log(tokens[j]);
           } }

Results in console:

Node,Node2,Node2,Lamp,Lamp,Node1,Node3,Node4   // string text
Node
Node2
Lamp
Node1
Node3
Node4

Thus it seems that it skips duplicates, when looping over the array.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
233 views
Welcome To Ask or Share your Answers For Others

1 Answer

This is an infamous gotchya in Unity:

very simply, in the Unity console:

IT DOES NOT PRINT DUPLICATES!!!

enter image description here

Look more carefully by the console output, and there's a Collapse toggle that makes it show or not show duplicates.

enter image description here

It's that simple.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...