Search Issue Tracker
By Design
Votes
0
Found in
2017.4.0f1
2018.2.0f2
2018.3.0a1
2019.1.0a1
2019.2.0a1
Issue ID
1129411
Regression
No
GameObject's name is changed when that GameObject creates a new GameObject passing a named argument to the constructor
How to reproduce:
1. Open the user's project
2. In the Project window go to Scenes/SampleScene
3. Enter the Play Mode
Expected result: TestObject name does not change
Actual result: TestObject name changes
Reproducible with 2017.4.21f1, 2018.3.7f1, 2019.1.0b4, 2019.2.0a6
This issue only occurs when the constructor is called like this:
GameObject obj = new GameObject(name = "Name3");
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- NavMeshModifier.OnEnable/OnDisable gets progressively slower when called repeatedly
- "System.Net.CookieContainer" throws an "ArgumentException" error when using a non-UTF-8 machine locale and hostname
- Crash on ModelImporter::ImportSkinnedMesh when disabling "Strip Bones" on a specific FBX model
- WebGL Development builds ignore the "Compression Format" setting when using "Gzip" compression
- [tvOS] Project crashes on startup on Apple TV simulator (both X86_64 and ARM64 architectures)
Resolution Note:
The users project is not using named arguments correctly.
It contains the line:
GameObject obj = new GameObject(name = "NameForNewObj"); // "this.gameobject" get the same name like the new object
But it should be:
GameObject obj = new GameObject(name: "NameForNewObj"); // "this.gameobject" get the same name like the new object
Notice colon ':' instead equal '='. In the first case the 'this.name' is assigned a value and not the 'name' parameter.