Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

making an object invisible and untouchable

Discussion in 'Scripting' started by Darknes, Sep 12, 2005.

  1. Darknes

    Darknes

    Joined:
    Sep 5, 2005
    Posts:
    21
    Hi, is possible to make an object invisible and untouchable from scripts?

    I haven't find anything in the docs.

    Thanks :)
     
  2. freyr

    freyr

    Joined:
    Apr 7, 2005
    Posts:
    1,148
    I'm not sure what you are trying to accomplish. But if you are talking about physics or collision related stuff, you could make sure the object has no collider or rigibody attached to it.

    For raycasting, you could use layers to either select or ignore objects.
    There was a discussion about that in this forum some time ago... I'll see if I can find it.
     
  3. Darknes

    Darknes

    Joined:
    Sep 5, 2005
    Posts:
    21
    I'm trying to make spawnable weapons. When a player take a weapon, the weap must be set invisible and untouchable and respawn after X seconds.

    Is it possible? Maybe it's possible to "disable" the weapon object and "activate" it after X seconds too or not?
     
  4. freyr

    freyr

    Joined:
    Apr 7, 2005
    Posts:
    1,148
    I think it would be easiest just to delete it and recreate it from a prefab when needed.

    You could have the spawn point be an empty game object containing the respawn script, that adds the weappon as a child to the respawn point.

    The respawn script would then have a pointer to the prefab containing the actual weapon.
     
  5. Darknes

    Darknes

    Joined:
    Sep 5, 2005
    Posts:
    21
    I can use the "Instantiate" function, to load the prefab right?
     
  6. freyr

    freyr

    Joined:
    Apr 7, 2005
    Posts:
    1,148
    That's correct.
     
  7. Darknes

    Darknes

    Joined:
    Sep 5, 2005
    Posts:
    21
    Thanks, i'll try.