Using findobjectoftype in private methods

In the lecture 66 we have:

why did we make this private and not public? I understand that findobjectoftype is public and access other scripts but why not just set the method to public?

Hi,

Do we need to access the methods in other instances? If not, do not make them public. public always makes your project prone to errors.

In lecture “Block Breaker Instructor Hangout #2” (currently #84) as of the 9:20 mark, Ben and Rick discuss why the public access modifier is “dangerous”.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms