Fields with the SerializeField
or SerializeReference
attributes should not be marked as unassigned.
CS0649 - Field is never assigned to, and will always be null
using UnityEngine;
class Camera : MonoBehaviour
{
[SerializeField]
private string someField;
}
The compiler detected an uninitialized private field declaration that is never assigned a value.
A field with the SerializeField
or SerializeReference
attributes are exposed to Unity and can be assigned in the Unity Inspector.