Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Getting the time in Thailand with System.Datetime will result in an error (IndexOutOfRangeException:

Discussion in 'Editor & General Support' started by saebashi, Nov 29, 2021.

  1. saebashi

    saebashi

    Joined:
    Nov 5, 2013
    Posts:
    13
    Getting the time in Thailand with System.Datetime will result in an error (IndexOutOfRangeException: Index was outside the bounds of the array.)
    I have looked around but the problem persists.

    This problem occurs when I run the IL2CPP build with the regional setting of my PC set to Thailand.

    [2019.4.16f1 windows standalone]

    Reference:
    I referred to the link and fixed it, but the problem persists. What should I do?
    Attached is the log and package.
     

    Attached Files:

  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,970
    If you are confident that you've explored all possibilities that you are giving it bad data or there is another problem in your code, make a new blank project that shows the bug and file an actual bug from within Unity, via Help -> Report Bug
     
  3. saebashi

    saebashi

    Joined:
    Nov 5, 2013
    Posts:
    13
    Thank you Kurt-Dekker.
    Copy that.
    However, I'm having trouble because this problem is occurring in an application that has already been released.
    Is there any solution to this problem?
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,970
    Guard it with a try/catch, make a new build I guess. If it's being called by Unity there's not much you can do except bring it to their attention, then when they fix it, rebuild your app with the fixed Unity.
     
  5. saebashi

    saebashi

    Joined:
    Nov 5, 2013
    Posts:
    13
    I checked and it doesn't seem to happen in Unity 2020.3.
    If it helps the rest of us.
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,518
    After seeing this thread, we decided to reactivate the bug (i.e. reconsider the by design resolution). We don't really want games randomly break just because a computer language is set to Thai. It seems that it was fixed by accident in Unity 2021.2 and we are looking at backporting the fix to 2020.3.
     
    OverHealer and saebashi like this.
  7. saebashi

    saebashi

    Joined:
    Nov 5, 2013
    Posts:
    13
    Thank you.
    I'm looking forward to Unity support.