SerializeField

I am wondering why we’re using SerializeField, when it seems to be unnecessary.

I discovered that by using:
float nameName =value;

it will still show in the inspector, so I can change values there.
So why? Does Serialize have some benefits?
It’s unclear to me.

Thanks for a great course.
M:)rten

You asked in Unreal but I assume you mean Unity. If I recall, it enables you to edit the value in the properties window.

Hi.

Thank you for your answer.
I can’t understand why this is in Unreal. The course sent me here, and it says Unity at top.

Anyhow, I wasn’t clear in my question, so I’ve updated it.
I know what it does, but I am unsure why, since float nameName = value; does the same job.

M:)rten

Is this perhaps a Unity 6 change because I know unless you made a public property or use [SerializeField] in older versions they didn’t show for editing on the GameObject within the game.

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

Privacy & Terms