Search Issue Tracker

Duplicate

Votes

0

Found in

5.3.3p2

Issue ID

778662

Regression

No

Unnecessary GC pressure in editor when querying for a component that does not exist

Editor - Other

-

Using this.gameObject.GetComponent<>(); uses much more memory if you are searching for the component that does not exist on that specific game object in the editor. In windows build and (as user reported) in android build this issue does not occur.

Steps to reproduce:
1. Open attached project's scene "TEST".
2. Enter play mode.
3. Open the profiler.
4. Click on "CAMERA" button few times.
5. Some little spikes are seen in profiler under Memory (GC Allocated - 0.9KB used).
6. Click on "LIGHT" button.
7. Huge spikes occur (GC Allocated - 5.7 MB)

This does not reproduce on android or windows builds. But does reproduce in both OSX and Windows 10 editors.

Reproduced on Windows 10 with 5.1.0f3, 5.3.3p3 and 5.4.0b10

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.