After a few years of C++, I'm diving into a different language (C#) with Unity. I'm doing my first class assignment. My professor has some variables declared as private, but she is initializing them instantly upon declaration. In C++, we wouldn't never initialize a private data member in the private block, but in a constructor. From what I read, we are not to use constructors in classes that are derived from MonoBehaviour
. So my question is:
Is it ok to initialize the private objects (Strings, ints, etc.) in upon declaration in a class in C#? Or is this something we shouldn't do, like in C++, and they should be initialized elsewhere?