On uploading hacker to sharemygame, error with requestAnimationFrame

When uploading to sharemygame.com, I encountered a warning. How do I fix this? The warning says that “SIMMER recommends fixing this…”

Your game threw a warning: Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!

SIMMER recommends [fixing this](https://forum.unity.com/threads/rendering-without-using-requestanimationframe-for-the-main-loop.373331/) and uploading again for better WebGL performance.

The warning is seen in the picture below inside the red rectangle.

Development environment:
WebGL build was created using Unity Editor 2019.3.9.
Visual Studio Community 2019 Version 16.5.3

Hi Pierre,

Does your game work? If so, ignore the message. If it does not work, could you please share the link to your game uploaded to sharemygame.com?

Hi Nina,

Thanks for the assistance.

Yes, the game works. Just wondering how I would fix that in the future. But, I’ll move on for now. May be this will get answered as I get more proficient with Unity though the class.

Thanks!
Pierre

I found this thread, which happens to be the same as the one linked in the error message. Did you change the framerate via code? If not, it might be that Ben or Rick did that in one of their classes. Open your WM2000 folder to find their scripts. I haven’t checked that, though.

If you did not change the framerate, you didn’t do anything wrong.

Hi Nina,

Thanks for digging more and the link to the thread.

I did find Application.targetFrameRate being used in file Assets/WM2000/Keyboard/Keyboard.cs

    private void Start()
    {
        audioSource = GetComponent<AudioSource>();
        QualitySettings.vSyncCount = 0; // No V-Sync so Update() not held back by render
        Application.targetFrameRate = 1000; // To minimise delay playing key sounds
        WarnIfTerminalNotConneced();
    }

After removing the line, I performed another WebGL build and uploaded to sharemygame.com, and the error wasn’t displayed. Also the game ran fine.

Thanks,
PIerre

Fantastic. Good job on fixing the issue, and thanks for sharing the solution with us. :slight_smile:

You’re welcome.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms