Search Issue Tracker

Fixed in 2021.1.X

Votes

1

Found in

2020.1

2020.1.2f1

2020.2

Issue ID

1272168

Regression

No

Slower performance of Instantiate() when using it in a build compared to the editor

Scene Management

-

How to reproduce:
1. Open user's attached "BugReport" project
2. Open Assets/Scenes/StartScreen
3. Enter Play Mode
4. Press the "Generate Chunks" button in the Game View window
5. Wait until the chunks are generated
6. Open the projects directory and open the temp.txt file
7. Observe how much time each chunk took to generate
8. Build the project
9. Run the build through the build's directory
10. Press the "Generate Chunks" button in the Build
11. Wait until the chunks are generated
12. Open the temp.txt file in the build's directory
13. Observe the difference time difference in the build and the editor

Expected result: It takes the same amount of time to instantiate a chunk in the Editor and in the Build
Actual result: It takes about 10 times longer to Instantiate a chunk in the Build

Reproducible with: 2020.1.5f1, 2020.2.0b3
Can't reproduce: 2018.4.27f1, 2019.4.10f1 (can't downgrade the project)

Notes:
- The temp.txt file contains the amount of time (ms) each chunk took to instantiate calculated using System.Diagnostics.Stopwatch
- Reproducible with Windows and Mac standalone builds
- Could not reproduce the slow performance by instantiating about 100000 cube prefabs
- I suspect the issue might be caused by Instantiating a large number of big prefabs
- You can see what kind of object the user is Instantiating by opening Assets/Prefabs/Chunk prefab and viewing the elements of "All Possible Objects" public variable

  1. Resolution Note (fix version 2021.1):

    Fixed in 2021.2.0a14

Comments (1)

  1. PutridEx

    Oct 06, 2021 05:56

    The state still says active even though the note says it's fixed.

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.