Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

EventSystem.Update() performance and World canvas

Discussion in 'Editor & General Support' started by peteRunner, Aug 21, 2018.

  1. peteRunner

    peteRunner

    Joined:
    Oct 7, 2014
    Posts:
    7
    Hi,

    I am little bit desperate, but still fighting. I have world canvas in GearVR application (Android). We use Google cloud speech recognition - Press Start button - speak - Press stop button. When I hit STOP button, profiler makes huge spike causing short freeze. Here is profiler screenshot running on device.
    I though, it was while speech conversion to audio file, but all calls area within GC-alloc in EventSystem.Update()
    screenshot.PNG

    Could you help me, what could cause spikes? I have optimized canvas - only one world canvas with raycaster and one button.

    Thanks
     
  2. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,431
    I have no insights into googles speech recognition but I can very well imagine that sending and receiving the data from it causing heap allocations like this. Web requests alone, also because they are mostly string based, are tough to keep GC free.

    Have you tried deep profiling this? you can deep profiler mono builds on Android by starting them like this:
    [I]~$ adb shell am start -n com.company.game/com.unity3d.player.UnityPlayerActivity -e 'unity' '-deepprofiling'[/I]

    see deep profiling here: https://unity3d.com//learn/tutorials/topics/best-practices/unity-profiler

    Then it might become more apparent, where the GC.Allocs are comming from, which is likely further down the callstack than just EventSystem.Update() I'd assume?