Unity Community


Results 1 to 5 of 5

  1. Posts
    33

    GetComponent(TrailRenderer).active ??? HELP :)

    this.GetComponent(TrailRenderer).active=false;

    why its deactivate my player and not the trail ??
    Thanks..


  2. Posts
    736
    Post some more of your code so we can get a better picture.


  3. Location
    Germany
    Posts
    1,215
    Quote Originally Posted by AgentChaos View Post
    why its deactivate my player and not the trail ??
    Because you are ignoring compiler warnings.

    Component.active is deprecated and should not be used with COMPONENTS. Component.active is/was a shortcut for "GameObject.active", hence if you have read the documentation (or MonoDevelop tooltips or the compiler warnings) you would know that this property is not listed in the docs and deprecated in MonoDevelop.

    Only "Component.enable" is documented and the only one which should be used, but that's something that the warning tells you too iirc.
    C# Developer
    www.Atomic-Gear.net
    Games:
    The Pirate Game: Android Market Link


  4. Posts
    33
    Thanks. So I can activate..How can I deactivate the trail?


  5. Location
    Germany
    Posts
    1,215
    Did you even read what I said? Component.active should not be used with Components, only with GameObjects. It's deprecated.

    To enable/disable a component, you must use Component.enable (set it to true to enable and false to disable)
    C# Developer
    www.Atomic-Gear.net
    Games:
    The Pirate Game: Android Market Link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •