Is PostprocessBuildPlayer file needed?

Some of my Unity projects (2021) that have been upgraded has a file called PostprocessBuildPlayer in the root Editor folder.

What process puts that file there, is it needed? What is it doing? See code below…

#!/usr/bin/env python
import sys, os.path, subprocess, fnmatch, re
editor_path = os.path.join('.', 'Assets', 'Editor')
editor_files = [i for i in os.listdir(editor_path) if os.path.isfile(os.path.join(editor_path, i)) and not i.endswith('.meta')]
editor_exec_files = [os.path.join(editor_path, j) for j in editor_files if re.match(fnmatch.translate('PostprocessBuildPlayer_*'), j, re.IGNORECASE)]
for exec_file in editor_exec_files:
  try:
    sys.argv[0] = exec_file
    subprocess.call(sys.argv)
  except OSError as e:
    print(exec_file + ' ' + str(e.errno))

Not all of my Unity projects have this in, wondering if I can safely delete, thanks

Unity used to allow calling a script PostprocessBuildPlayer and have it run after a build to do post-processing. This was in the very early days of Unity, when the editor only ran on Mac and before PostProcessBuildAttribute existed.

That attribute was added in Unity 4.3 and the support for the PostprocessBuildPlayer script removed in Unity 4.5.

Likely, your project used a plugin that still included support for such old versions of Unity by including the file. Since it doesn’t do anything nowadays, you can safely remove it.

1 Like

Thanks, I never used a version that eary but like you say a plugin might have been using it :slight_smile: