INSTEAD OF WRITING PUBLIC LIKE THIS:- public GameObject object; YOU CAN WRITE SERIALIZEFIELD LIKE THIS:- [SerializeField] GameObject object;