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. Dismiss Notice

gameObject.renderer.enabled = true/false;

Discussion in 'Scripting' started by Bleedblue1125, Feb 24, 2015.

  1. Bleedblue1125

    Bleedblue1125

    Joined:
    Jul 4, 2014
    Posts:
    18
    Hi, my question is that if I use gameObject.renderer.enabled, will it disable the collider that is on it as well?
     
  2. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
    No, just the renderer.
     
  3. Bleedblue1125

    Bleedblue1125

    Joined:
    Jul 4, 2014
    Posts:
    18
    Thanks for the really quick response - how would you disable the collider?
     
  4. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,510
    Code (CSharp):
    1. gameObject.collider.enabled = false;
     
  5. Bleedblue1125

    Bleedblue1125

    Joined:
    Jul 4, 2014
    Posts:
    18
    Thanks a lot Schneider - much appreciated.