Search Unity

[Help] Is there a way for Visual Studio to auto correct deprecated C# Unity Code?

Discussion in 'Code Editors & IDEs' started by Tomu_Cat, Mar 30, 2017.

  1. Tomu_Cat

    Tomu_Cat

    Joined:
    Mar 30, 2017
    Posts:
    1
    Hi guys, I wasn't sure where to ask this question, so apologies if this is in the wrong place.

    I know Unity has the api updater but that seems to be greyed out for me even with the deprecated code is in my scripts. I know when you open an old project in a later version of Unity it does the changes for you and obviously visual studio knows the changes that need to be made. So is there a way for visual studio to make these corrections for you? My current course is in unity 4 but i really want to learn up to date code and i find often i run into confusion regarding old code.



    Bonus question; Also i notice when i type code sometimes the auto correct wants to jump in and change it to something else while i am typing and i find both the tab and space keys seem to accept these changes, is there any way to avoid this happening?

    Thank you.
     
  2. Pengocat

    Pengocat

    Joined:
    Dec 7, 2016
    Posts:
    140
    If I were you I would install the same Unity version that the course is using. As long as you are learning you should not be fighting the version problems. When you get comfortable in Unity you can quickly learn what has changed in Unity 5. It is not that many things that has been changed from Unity 4 to 5 in regards to the API. Most of the changes has happened behind the scenes that you won't notice.
     
  3. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,497
    There isn't. The [Obsolete("...")] attribute doesn't provide anything more than a note about something being Obsolete.

    This is all that's happening on the back end:
    shot_170330_125328.png


    Unity's automatic script upgrader is something Unity provides when these methods actually go away but they want to be nice and automagically fix your stuff so you don't have to.
     
    Professor_Bossco likes this.