Search Unity

Feedback IAP 4.6.0 -> Unnecessary usage of nullable operator on nullable types

Discussion in 'Unity IAP' started by PeachyPixels, Mar 14, 2023.

  1. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    713
    Hello!

    As per the title, can Unity please reconsider (what appears to be) a new trend of using the nullable operator (?) on nullable types.

    I see this usage on the two breaking changes introduced in 4.6.0...

    Code (CSharp):
    1. void OnInitializeFailed(InitializationFailureReason error, string? message);
    2. void RestoreTransactions(Action<bool, string?>? callback);
    It's a non-standard thing to-do as strings & objects are already nullable types, so the operator is not required.

    In-fact specifying the operator will likely cause confusion (and warnings if replicated in client code) for those less experienced with C#

    No operators will work in exactly the same manner...

    Code (CSharp):
    1. void OnInitializeFailed(InitializationFailureReason error, string message);
    2. void RestoreTransactions(Action<bool, string> callback);
    Thank you.
     
    Last edited: Mar 14, 2023
  2. Yannick_D

    Yannick_D

    Unity Technologies

    Joined:
    Feb 21, 2022
    Posts:
    233
    Thank you for your feedback PeachyPixels!

    The team has discussed this and we will make sure not to expose any nullable going forward.
    The existing ones will be changed in our next release.
     
    PeachyPixels likes this.
  3. PeachyPixels

    PeachyPixels

    Joined:
    Feb 17, 2018
    Posts:
    713
    Thanks @Yannick_D it's much appreciated.

    Could you also please consider removing the old (obsolete) method as well?
    Code (CSharp):
    1. [Obsolete]
    2. void OnInitializeFailed(InitializationFailureReason error);
    The 4.6.0 update included breaking changes to the interface (contract) so required developer input\changes anyway.

    There is now an obsolete method hanging around that is not being called\used (from what I can gather)

    Thanks again for the update.
     
    Yannick_D likes this.
  4. Yannick_D

    Yannick_D

    Unity Technologies

    Joined:
    Feb 21, 2022
    Posts:
    233
    Some methods were marked as [Obsolete] in 4.6.0 because we were trying to avoid causing a breaking change...

    We will be removing them in the next major release to avoid causing more breaking changes until then!
     
    PeachyPixels likes this.