Unity Community


Results 1 to 6 of 6

Thread: Power button


  1. Posts
    216

    Power button

    hi again again and again. I'm just getting crazy I am new in unity please help me

    I have a Power button in my game and I want when I getting close to button and press E one animation get play
    but I have no Idea how can I do that, I've search for that but can't find anything

    my mean is something like trigger in UDK


  2. Posts
    68
    There are trigger functions in Unity so do a search on (OnTriggerEnter or OnTriggerExit) and I'm sure things will get a bit more clear.


  3. Posts
    216
    thanks. I've seen that but I don't know how it works


  4. Posts
    68
    If you have a game object with a meshcollider attached to it, you can set a property 'is trigger' to true inside the inspector.

    Inside your script you can then check with the OnTriggerEnter function if some 'other' collider has enterered the trigger, and if so, perform any desired action.

    If you like to know more, either read some more about it or wait till someone else comes in and can give you more details on this because I'm a starter with Unity myself However, the function itself is pretty easy to understand.

    Oh btw, the 'other' collider is if I'm correct a special case, so you don't have to assign a specific collider in the script in order for the trigger to work, it will get triggered by any other collider that collides with it.
    Last edited by RANDOM++; 04-28-2012 at 01:01 PM.


  5. Posts
    216
    OMG. that was a big help thanks a lot a real lot thanks thanks


  6. Posts
    68
    Good luck with it and if you have any problems just post it here, I always like to know what went wrong/good and if I can help I will

Posting Permissions

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