Skip to main content
added 240 characters in body
Source Link

If you don't declare any access modifier (public, private or protected), the default is private, meaning it will not show in your inspector and will not be accessible from outside of the class.

Making the property [SerializeField] will make it show up in the inspector and you could edit it, but still, because it is private (by default) it will not be accessible outside of the class.

Making the property public will make it both show up in the inspector and other class could access this property from outside the class.

You might want to make your property public but make it not visible in the inspector, just add the [HideInInspector] attribute above the desired property, that way its accessible from outside the class, but not from the inspector.

You can read more about it here and here.

If you don't declare any access modifier (public, private or protected), the default is private, meaning it will not show in your inspector and will not be accessible from outside of the class.

Making the property [SerializeField] will make it show up in the inspector and you could edit it, but still, because it is private (by default) it will not be accessible outside of the class.

Making the property public will make it both show up in the inspector and other class could access this property from outside the class.

You can read more about it here and here.

If you don't declare any access modifier (public, private or protected), the default is private, meaning it will not show in your inspector and will not be accessible from outside of the class.

Making the property [SerializeField] will make it show up in the inspector and you could edit it, but still, because it is private (by default) it will not be accessible outside of the class.

Making the property public will make it both show up in the inspector and other class could access this property from outside the class.

You might want to make your property public but make it not visible in the inspector, just add the [HideInInspector] attribute above the desired property, that way its accessible from outside the class, but not from the inspector.

You can read more about it here and here.

Source Link

If you don't declare any access modifier (public, private or protected), the default is private, meaning it will not show in your inspector and will not be accessible from outside of the class.

Making the property [SerializeField] will make it show up in the inspector and you could edit it, but still, because it is private (by default) it will not be accessible outside of the class.

Making the property public will make it both show up in the inspector and other class could access this property from outside the class.

You can read more about it here and here.