7

Is there a way to run a script method automatically before I build via File > Build Settings... > Build?

I know I can make a menu item to call my method and call build afterwards.

2
  • AFAIK you can only execute scripts after building via PostprocessBuildPlayer. Can you explain the purpose of your script in more detail so we can look for an alternative way. Commented Dec 6, 2013 at 9:05
  • My script just builds and copies the resulting DLLs of some plugins into the Plugins folder. Commented Dec 6, 2013 at 12:38

2 Answers 2

13

You can Use IPreprocessBuildWithReport interface in Unity 5.6+

Sign up to request clarification or add additional context in comments.

2 Comments

I don't even remember why I wanted that, but this is awesome, thanks! Is it in the release notes?
IPreprocessBuild is obsolete! Use IPreprocessBuildWithReport instead!
2

AFAIK, Unity API doesn't offer any pre-processing/pre-building capabilities connected to the build command from the menu.

But on the other hand, you can make an editor script that does all the process from building your DLLs, importing them and then building your app. Take a look at the BuildPipeline to achieve this purpose.

This way you can write your own pipeline. But you will need to call this from an editor script though, not from the menu as you asked for in your question.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.