Bugs in the Unity programming environment

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(do .. while loops work incorrectly)
m (do .. while loops work incorrectly)
 
Line 7: Line 7:
  
 
== <code>do .. while</code> loops work incorrectly ==
 
== <code>do .. while</code> loops work incorrectly ==
'''This bug has been fixed with Unity 4. However it is present in Unity 3.x.'''
+
'''This bug has been fixed with Unity 4. However, it is present in Unity 3.x.'''
  
 
This seems to be specific to UnityScript. The body of the do...while loop will be executed at least once, as it should, but then the body will be executed again until the condition (the "while" part) becomes '''true'''. Note that if it worked correctly, it would loop until the condition became false.
 
This seems to be specific to UnityScript. The body of the do...while loop will be executed at least once, as it should, but then the body will be executed again until the condition (the "while" part) becomes '''true'''. Note that if it worked correctly, it would loop until the condition became false.

Latest revision as of 11:21, 5 December 2012

These are some bugs in the Unity programming environment that I've reported to Unity but which haven't been fixed as of the last time I checked. Also included are some past bugs that were there in Unity 3.x but are fixed in Unity 4. Please feel free to update this list if you have evidence any bug has been fixed.

[edit] print() function works only intermittently

I do not know if this is bug occurs in Unity 4 due to its nature of being hard to reproduce. However, it was present in Unity 3.x.

I have not isolated the specific conditions that cause this bug, but in very few cases, the print() function/statement will simply fail to work. This happens in both UnityScript and Boo. To avoid this bug, you can instead use Debug.Log(), which does not seem to fail in any of the cases where print() fails.

[edit] do .. while loops work incorrectly

This bug has been fixed with Unity 4. However, it is present in Unity 3.x.

This seems to be specific to UnityScript. The body of the do...while loop will be executed at least once, as it should, but then the body will be executed again until the condition (the "while" part) becomes true. Note that if it worked correctly, it would loop until the condition became false.

Here's a test case:

print("I can count to ten!");
var n : int = 0;
do {
     n++;
     print(n);
} while (n < 10);

What should be produced is (line breaks omitted):

I can count to ten! 1 2 3 4 5 6 7 8 9 10

Instead what I get in Unity 3.x is:

I can count to ten! 1

Similarly, the following code produces an infinite loop when it should not. NOTE: Running this code will cause Unity to freeze and require a restart.

var n : int = 0;
do {
     n++;
     print(n);
} while (false);

In reality it should print "1" and finish.

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox