When to use events

So when I started with c# (just c# not unity) I was learned OOP was extremely important. Put as less code as you can in each function class etc. So it won’t become a mess.

But how is this for unity?
Like for an health/damage system. You can make a public method in a class called take damage that gets called from another class. But the way I learned c# is that this is not a good way.

That would be to use events (or maybe delegates) for the function. So that the one class doesnt know what the other is they just do theyre stuff. Is this important for unity? Since it is a lot more difficult and requires more code.

Unity supports OOP, but YOU are coding. Use what you feel is best for your design. In the end, it’s you who has to support your code (unless you work for a company, and then they will tell you what to use). Personally, I’m a strong proponent of OOP, but that’s just a personal choice.

What csofranz says is true but don’t let that deter you from learning new techniques. Events are extremely useful and only difficult to use effectively if you haven’t learned them yet… Keep learning various ways to achieve certain functionality and use that to code more efficiently and to your own style. We are always learning and improving!