Search Issue Tracker

Postponed means that the issue was either a feature request or something that requires major refactoring on our side. Since that makes the issue not actionable in the close future we choose to close it as Postponed and add it on our internal roadmaps and technical debt pages instead.

Postponed

Votes

0

Found in

5.2.2p1

Issue ID

740896

Regression

No

Making a copy of a struct does not properly copy it's values

Scripting

-

Steps to reproduce:

1. Open attached project
2. Inspect 'Test.cs' script, notice it makes a copy of a struct and compares their integer values afterwards
3. Open and play 'Scene'
4. Read the console: The 'copied' value is not 0, but some random value
5. Press 'Stop'
6. Press 'Play' again
7. Read the console again: The 'copied' value is another random value (the value is different with each play)

Expected behaviour: The copied value and the directly read value are always equal (in this case, 0)

Notes:
1. In MonoDevelop console project the issue does not occur (project is in the attached zip)
2. If you move the DoTest() method outside the struct, for example into the monobehaviour, the problem disappears
3. If you use two different structs, one inside the class and one inside the monobehaviour, the problem disappears
4. If you use a class instead of a struct, the problem disappears

Reproduced with: 5.0.4f1, 5.1.4f1, 5.2.2p3, 5.3.0b6

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.