What are the different between this?
???
SerialiseField is used to expose a variable to the inspector. Use it when you want to drag and drop a reference.
GetComponent is used to get a reference to a specific component when you have a reference to its GameObject.
Functionally once you have a reference they are identical.
So drag and drop reference is the same as GetCompoent?
The reference is the same, yes.
Drag and drop is appropriate for things that already exist on the scene. GetComponent does the same thing in code.
1 Like