Search Feedback

176
votes

Remove obsolete/deprecated methods/components

Scripting

-

-

Please remove most of/all obsolete code. There's now extreme amounts of code left overs since the early days cluttering down intellisense for no reason. Some major pains are the public static methods in Quaternion, GameObject and the default components in all Objects.

I'm a teacher trying to teach people to use Unity, and telling people they have to make a new variable and reference it to the assigned Rigidbody instead of just using ".rigidbody" is a major confusing for a lot of people. Not to mention that you'll have to hide the member using "new" if you want to use that particular name.

I feel like this is long overdue now. With the introduction of a new Versioning system (since 201x.x) it's a perfect opportunity to break some backwards compatibility for once. If people still want to work on their legacy code they'll just have to upgrade or suck it up. The clutter is starting to get real.

Comments (5)

  1. Fa823619738c01374722c58935fbc2cd?d=mm

    leonardoraele

    Oct 27, 2018 20:29

    You can't just remove legacy code, it would break apps using them.

    Instead, legacy code should log warning in the console and be highlighted as DEPRECATED in the documentation.

  2. 2327d479768451143ec989f11327b3a4?d=mm

    Vince-Chimp

    Jul 26, 2018 08:28

    For the love of all, even if you are not going to remove them, give us an option to switch to a version of unity's codebase that simply Does not contain the deprecated methods.
    So that if you are writing code you don't get bothered by RANDOMRANGE when you want RANGE inside Random, and all those other useless old methods that could have even been UnityUpgradeable for over a year or more.

    Deprecation == get rid of it next big unity version. It is not that hard. The comments on what to use instead is 99% clear enough to resolve a deprecation anyway.

  3. 90ae2ed3429ef8ab4087fb7105407bd6?d=mm

    Bunny83

    Jul 09, 2018 03:11

    I think the main reasons why they still keep outdated / deprecated / not functioning methods, properties and classes is to show a proper warning in the editor. If a project contains deprecated elements and Unity would remove them, the code will no longer compile. However the warnings depend on a successful compilation in order to access the attributes and to get the warnings. A better suggestion would be to mark completely obsolete things with the "EditorBrowsable(false)" attribute which will make Visual Studio to not show / suggest it anymore. So it would still be there and still compile but would not clutter intellisense.

    Unfortunately Microsoft is not willing to provide a way to hide deprecated members in Visual Studio due to lacking support of us:

    https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/14422473-hide-obsolete-items-in-intellisense

  4. 323ebc87c1d690288ce762b0415b72f8?d=mm

    chaosmaker

    Apr 16, 2018 12:13

    some deprecated code doesnt work. so you can call the method but nothing happens. why does it even exist then?

  5. 849ebd1f0cf3b83531dba72de32f3adf?d=mm

    LoungeKatt

    Apr 11, 2018 03:28

    I don't entirely understand your closing comment. "If people still want to work on their legacy code they'll just have to upgrade or suck it up" is a contradiction. Wouldn't it be that if people want to work on their legacy code they will have to stay on a previous version or update the code? They wouldn't upgrade to work on legacy code, since it would be incompatible.

    I am all for removing deprecated code after a reasonable interval, so long as the #if !UNITY_X_OR_NEWER tags continue to completely ignore that code (to prevent it breaking compatibility with newer builds) and there is still some way to access past documentation. Many professional game platforms, such as PSN or Nintendo, require using a specific version of the editor and it is often outdated.

    I do hope your students aren't that confused by things like deprecation. It would be unfortunate to see them unable to work at certain companies simply because of the Unity version they currently require.

Your opinion counts

Help us make things better. Share your great idea for improving Unity or vote for other people’s.

Log in to post a new idea

Categories

All

(10797)

2D

(282)

Ads

(56)

AI & Navigation

(84)

Analytics

(133)

Animation

(396)

Asset Store

(356)

Asset Store Publisher

(17)

Assets

(544)

Audio

(185)

Cloud Build

(145)

Collaborate

(65)

Docs & Tutorials

(240)

Editor

(2513)

Everyplay

(19)

Game Performance Reporting

(22)

General

(981)

Graphics

(870)

GUI

(432)

Input

(173)

Licensing

(92)

Networking

(189)

Physics

(384)

Platforms

(442)

Profiling & Optimization

(85)

Runtime

(182)

Scripting

(1169)

Terrain

(172)

WebGL

(143)