Search Issue Tracker

By Design

Votes

0

Found in

2017.3.1f1

Issue ID

1005424

Regression

No

Adding GameObjects to Dictionary Corrupts Some Transforms

Themes

-

How to reproduce:
1. Download attached project file
2. Copy the fbx folder and the StandaloneTest.cs script into the transform_bug assets folder
3. In the menu bar, select PLW Import->Standalone Test. An EditorWindow is displayed.
4. In the EditorWindow, click "Import Full (fails)" to run the test
5. If the test fails (meaning that it exhibits the bug), an error will be displayed in the console

Actual result: The code imports some tmaps, then imports some FBX models. It loads each FBX model and instantiates it as a GameObject. It adds each GameObject to a Dictionary container. During the call to Dictionary.Add(), several of the GameObject transforms get corrupted. One symptom is that the transform.localPosition value becomes (0,0,0).

Reproduced with: 2017.1.3p1, 2017.2.2f1, 2017.3.1p2, 2018.1.0b9, 2018.2.0a2

Notes:
- The failure occurs on both Windows and MacOS.
- The failure occurs only when the tmaps are imported first. If the tmaps are already in the Assets folder, it does not occur unless a large number of models (5000 - 10000) are imported.
- The number of objects that get corrupted can vary

--------------------
By design:

The problem is with the user script: the user expects to be able to change the local transform of root game objects after import. This is not possible. Instead, the user should nest the imported game object under an empty game object in the scene, then he can change the local transform relative to that root. One option is to do this in an AssetPostProcessor, so that the desired transform is applied during import.

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.