Search Issue Tracker
By Design
Votes
0
Found in
5.6.0p1
Issue ID
905457
Regression
No
Null properties return not null, even though variable is set to null
If you declare a property with a null value, it will be silently converted to not null
To reproduce:
1. Download attached project "905457.zip" and open in Unity
2. Open "Scene" scene
3. Create new Game Object and add the NullProperty component
Note: In Inspector you will see that the property called "NULL_PROPERTY" has a not-null value and that the property called "NULL_STRING" is null
4. Open NullProperty sript and in 21 line write "string foo = null;" and save it
5. Go back to Unity
6. Wait until sript reloads
Expected result: In Inspector you will see:
"NULL_PROPERTY == _not null_!"
"HIDDEN_NULL_PROPERTY == _not null_!"
"NULL_STRING == NULL"
"HIDDEN_NULL_STRING == NULL"
Actual result: In Inspector you will see:
"NULL_PROPERTY == _not null_!"
"HIDDEN_NULL_PROPERTY == _not null_!"
"NULL_STRING == _not null_!"
"HIDDEN_NULL_STRING == _not null_!"
Reproduced on Unity 5.5.3p2, 5.6.0p3 and 2017.1.0b2
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- OnPostprocessAllAssets() is not called for a modified Prefab when another Asset is set Dirty in the same callback
- [Android] UIToolkit ClickEvent is fired when the device is rotated
- Compilation errors occur when "uintBitsToFloat(int)" gets used in OpenGLES
- User Reporting does not send reports when Managed Stripping Level is set to Low or higher
- Editor crashes and a window with "GetManagerFromContext: pointer to object of manager 'MonoManager' is NULL (table index 5)" error is thrown when launching a project with a corrupted library
Add comment