Unity freezes when settings QualitySettings.VSyncCount = 0


I am having a weird issue, whenever I try to change the value of the VSync through code, my game freezes entirely and stops responding

I am using Unity 2020.3.24f1, and here is my simple lines of code :

    public void SetVsync()
        PlayerData.GetInstance().Vsync = !PlayerData.GetInstance().Vsync;

        if (PlayerData.GetInstance().Vsync) QualitySettings.vSyncCount = 1;
        else QualitySettings.vSyncCount = 0;

If I click the button once, the VSync will be enabled, but if I press the button again, that’s all, the app freezes … I really don’t get it, this isn’t my first game like I am not dumb this should work

PlayerData is my player settings class, I am using a singleton to modify the variables
Vsync is a boolean
The method is called when a button is pressed, I checked, there are no infinite loops, and it freezes ONLY when the VSync is set to 0

Edit : I am on a MacBook Pro M1, and this happens in the built game, nothing happens in the editor

u figure it out yet or…?