I have observed some interesting behaviour when declaring gridSize in the Waypoint script as a const. I was wondering why the CubeEditor script did not simply call the variable gridSize in Waypoint script with the statement “gridSize = waypoint.gridSize”, as opposed to calling the method GetGridSize. So I tried it. In the Waypoint script, I edited the defining statement to “public const int gridSize = 10;”. I noticed however that gridSize was not showing up in the inspector, nor was “gridSize = waypoint.gridSize” in the CubeEditor script deemed acceptable. But if I removed the letters “const” from the declaration in Waypoint script, gridSize showed up in the inspector, and was acceptable to its use in the CubeEditor script.
So it seems that “public const int gridSize =10;” will compile without any errors, but the use of “const” nullifies the use of “public”, and requires the method GetGridSize() to access the constant. I found this interesting and thought I’d share.