Portal.destination

In the Portal.cs while looping through the portals we use portal.destination to check each portal’s destination enum variable.

How does that work when destination is a private variable?

It just happens that since the variable is in the same class (Portal), it can see all the variables in another instance of Portal (yep, even the private ones).

  • private: Inaccessible outside of the class (but visible to any other instance of the class
  • protected: Inaccessible outside of the class or descendants of this script (but visible to all instances of the class or it’s descendants
  • internal: Inaccessible to anything not within the same assembly, visible to anything within the assembly. (We don’t deal with this unless you start playing with assembly definitions).
  • public: Visible to every class.
1 Like

Thank you for the clarity!

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

Privacy & Terms