Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ICHeeryI · Nov 25, 2013 at 09:09 PM · functionput

What could I put in function brackets?

I've been programming for a while. Now I want to know what could I put in function brackets. I don't know how to explain this so I can't search over google. Sometimes I used it when I needed but I don't quite understand it. So if anyone want to explain it to me, it would be great. For example:

 function OnTriggerExit(other : Collider){
 
 if (other.tag == "Name"){
        //Do something}
 
 }
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by rednax20 · Nov 25, 2013 at 09:23 PM

What you have up there is the real gist of it. you can use pretty much anything, i only know of a few exceptions. You could use public functions, private functions, variables, unity methods, your own methods, if statements, while loops, for loops, Unity variables, declare variables, change variables, instantiate, destroy, move, alter, and more!

OnTriggerEnter is what we call a generic functions,

http://docs.unity3d.com/Documentation/Manual/GenericFunctions.html

generic functions are unity built in things shall we say, they are run the code in there brackets when a certain thing happens in your game that would be hard to detect through just plain old codeing.

remember when i said there were a few exceptions, well you coroutines can get a little dodgy with some of the functions, and you cannot use a generic function within another generic function.

I'm sure that there are lots more exceptions but i can't think of anymore off the top of my head.

For an example of its usage, lets say you have a sword. You might use OnTriggerEnter() to tell when the sword has hit something.

The short answer is : Practically Anything.

hope this answered you question,

Quishtay™ all the way

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ICHeeryI · Nov 25, 2013 at 10:16 PM 0
Share

Thanks, this really helped me a lot.

avatar image rednax20 · Nov 25, 2013 at 11:01 PM 0
Share

no problem. Always happy to help

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Is there something like the parseInt function for doubles? 1 Answer

is it possible to pass functions through functions? 2 Answers

The Walking Dead Game Animation Style 1 Answer

Finding the angle between two GameObjects 1 Answer

How can I make a function wait before it starts running again? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges