Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

GameObject.renderer & GameObject.Getcompoent<Renderer>()

Discussion in 'Scripting' started by rockysam888, Jul 25, 2015.

  1. rockysam888

    rockysam888

    Joined:
    Jul 28, 2009
    Posts:
    650
    Hi all,

    "GameObject.renderer" is replaced by "GameObject.Getcompoent<Renderer>()".

    Are there a complete list of other variables of GameObject that are deprecated too?

    Thanks in advance
     
  2. Lysander

    Lysander

    Joined:
    Feb 24, 2013
    Posts:
    1,648
    Not that I know of, but that was the big one when it comes to GameObjects specifically, and it made completely sense. They were also thinking of making .transform work differently in the background so that it's faster (right now it's really the equivalent of calling GetComponent<Transform>()), but that doesn't seem to have happened.

    If you want a complete-ish list of changes, just check the "big" release notes, like Unity 4.0 and 5.0. Here's the latest: http://unity3d.com/unity/whats-new/unity-5.0
     
  3. rockysam888

    rockysam888

    Joined:
    Jul 28, 2009
    Posts:
    650
    Thank you, Lysander.
     
  4. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,431
    All of the shortcut accessors except .transform and .gameObject were deprecated.

    They promoted internal dependency. They were simply wrappers for GetComponent anyway, this sort of practice was misleading.