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 OlleStarclassic · Oct 04, 2021 at 07:41 PM · methodintellisense

How can intellisense in Visual Studio know how to write the whole method declaration for for example OnTriggerEnter ?

Hello :)

When I start writing ”ontr ” intellisense autocompletes when I press tab and suddenly all of the code for OnTriggerEnter is there.

Like magic :)

I want to know how intellisense does this.

How do intellisense know there is a method named OnTriggerEnter that I might or might not want in my class?

Is the method inherited from MonoBehavior somehow?

Is it an interface? (But then the method must be implemented in my class right? In this case I can choose to not implement it if I want to)

Is it a snippet intellisense can see?

Also if i implemented the code for OnTriggerEvent and then try to write ”ontr” again intellisense does not show OnTriggerEvent in the list of available methods to implement.

How can intellisense know that I have already implemented this code?

I understand how intellisense can see that there is a field in a class and autocomplete if I start typing the fields name.

Also the same if I have declared a method in a class and start typing the methods name in another method or in the constructor.

But here I don’t understand.

Intellisense does not know of the method and knows how to write the whole code for writing that method?

I am sure there is a simple explanation that I did not think of but I have googled this for some time and can not get the answer myself.

Greatful for any replies :)

Thanks in advance

Best Regards

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
0

Answer by Eno-Khaon · Oct 04, 2021 at 09:31 PM

Unless I'm misunderstanding something, it looks to me like Unity's implementation of various preset functions (to be utilized/overridden, as it were) probably make use of AutoCompleteAttributes (or similar-enough) to allow them to be constructed as completely and automatically as possible.

Comment
Add comment · Show 1 · 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 OlleStarclassic · Oct 04, 2021 at 11:11 PM 0
Share

Ok thanks :)

Will try it out tomorrow.

So if I write [autocomplete] before my method I write myself, Intellisense will then display it as a method which can be autogenerated if I start writing the name of the method in a class outside of a method? (Where I usually write new methods)

Cool :) (Sounds like there is more to it but will try it out :)

Thanks for the answer :)

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

126 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Webplayer exception when using BufferedStream 0 Answers

Method not found: 'UnityEngine.AudioSource.PlayOneShoot'. 1 Answer

Mutator method to change multiple bool variables? 2 Answers

How to execute a function which is implemented in .NET when I have its name as a string? 1 Answer

Can't assign SetActive because it's a "method group". 0 Answers


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