Question is off-topic or not relevant
Why are Unity events so special?
Hi, I was looking into a problem in my code and I came across a thread that talked about events. Then I looked up events, watched a few videos, read some forums, and I'm baffled about what's so special about them... What's the difference in between declaring an event and initializing a public variable, putting an if statement in update, and calling a function there? I've just heard a lot of people like them.
The problem that I've been dealing with, and wondering if it would be easier to fix with events, is as follows: I have a bunch of enemies in my scene that don't do anything until a certain amount of enemies have already been killed. I wanted to make them inactive until they need to be present to cut down on checking for collisions, rendering, etc.
Thanks in advance!
Answer by Cuttlas-U · Apr 29, 2020 at 05:07 AM
Hey; be events if u mean delegates , they are not for unity ; its a c# thing ;
but there is no need to use it ; just make a check function and each time an enemy die call it so u would have a nice checking ;
yousing events are more clean but they have their own cost like subscribing and unsubscribing or data got stuck in memory etc ...