- Home /
Is it okay to mark well-known events as private?
Is it okay to mark well-known events (such as Update or OnCollisionEnter) as private? Are there situations where doing so is a bad idea?
Answer by Ehren · Nov 02, 2009 at 08:05 PM
This recently came up on the #unity3d irc channel.
According to NCarter:
If you have any inheritance going on, I recommend that you don't use private visibility for any of the event methods such as Update etc. Use at least protected, or public if that happens to be better. If you use private, it's easy to accidentally hide a base class implementation of the same method, which means that the engine may call either version as it sees fit.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
How can an editor script know when another script was removed from the project? 1 Answer
Adding single Event listener to multiple ui buttons via scripting 1 Answer
Play sound on animation event? 3 Answers
Can someone help me fix my Javascript for Flickering Light? 6 Answers