OnEnable is called when the script gets enabled -- in this case on starup. It checks -- does the object already exist? If so, destroy the previous one before assigning this one to be the new one.
Generally a singleton is done similarly, except that it destroys the second object to be created, not the first.