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. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Official [Blog Post Discussion] Clarifying API usage requirements via improved messaging

Discussion in 'Scripting' started by Unity_Javier, Aug 30, 2022.

  1. Unity_Javier

    Unity_Javier

    Unity Technologies

    Joined:
    Mar 7, 2018
    Posts:
    130
    Hi everyone,

    We're excited to share our team's latest blog post with you:

    Clarifying API usage requirements via improved messaging

    Questions, comments and suggestions are all welcome. We're looking forward to hearing from you!
     
    karl_jones and UnityMrAndyPuppy like this.
  2. mahdi_jeddi

    mahdi_jeddi

    Joined:
    Jul 18, 2016
    Posts:
    216
    In worst case scenario for issues caused by this, you could add a compatibility option in project settings to let the calls go through, so that people know they need to fix them, but doesn't completely break their code. At some point you could remove this option to force everyone to fix their code.
     
  3. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    5,970
    The error messages should really say something about why the API can't be used at such a time! It's always very frustrating when you do something that you think should work, and the engine just goes "no you can't". A simple "that data is currently being changed so using the call will lead to inconsistent results" at the end of the error message will go a long way to alleviate annoyance.


    Also, whenever you add a warning/error like this, make sure that it's actually sensible. I still keep getting upset that this:
    Code (csharp):
    1. void OnValidate() {
    2.     gameObject.tag = "Something";
    3. }
    Causes this:
    upload_2022-9-14_17-8-5.png
     
    Richay, ralexovi, katerd and 2 others like this.