Is there any difference between [SerializeField] and a public variable?

Hello,

I was wondering if there is any real difference between [SerializeField] and a public variable.

I use a lot [SerializeField] to expose private variables and [HideInInspector] to force serialization but no to show it in the inspector, mainly because I prefer to have private variables and public properties for them as a general rule to keep things better organized in my code (at least for myself)

But I was wondering if there is any big performance hit, or any other thing hidden inside by using this style of exposing variables.

Thanks a lot.

Italo F. Capasso AKA "Edwod Grant"

As far as I can tell with our usage of it, there is no difference for what you want to use it for. Personally, I'm with you where I prefer to keep my variables private, or at least hidden behind properties, and using `[SerializeField]` explicitly for things that show up in the inspector.

It does make porting code to the iPhone (at least currently) a pain, though, since that property isn't in Unity iPhone.