The Organization

Oh Unity3d, why do you pain me so

An interesting bug when using Unity Events... You have created a class with a method like public void MyMethod(), and have a unity event which targets that method. You later decide that the method should be private rather than public. The unity event does not care about the access change, and happily continues to call your, now private, method. Also, it can be very difficult to find what unity event is actually calling your method, making tracking down this kind bug very difficult. A "fix" is to change the name of the method, thus breaking the unity event reference. But that is not ideal. I do not have a solution, other than that the unity events should respect the access modifiers on the methods they are calling. With the knowledge that that would likely be run-time costly, and so maybe not worth it.

unity3d programming til permalink