Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by vexe · Jun 16, 2016 at 02:57 PM · buildandroid buildbuildpipelineeditor extension

Custom Pre Build Process?

Greetings,

So when you build for Android, Unity starts the build, compiles scripts, converts classes to dex format, finds a device and installs/launches the game on it.

In the build settings there are two things you need to specify: the cube store password and the bundle identifier.

The problem is, if you fail to provide the cube password correctly, Unity won't tell you that you don't have a correct password right away but instead stupidly continues the build process and lets you at 75% of it.

Same thing for the bundle identifier, if it's older than the one installed on the device it screams unable to install downgraded version etc.

It blows my mind that it has to wait till almost the end of the build to do those checks, why not abort immediately at the beginning?

I've wasted so much time and got frustrated because of that...

Is there any way to intercept/customize this build process to do those checks at the beginning? I could ILSpy the editor code and try to figure out what the 'Build' button does (pretty sure I'll end up in a closed end/extern'ed code). But before I try that was wondering if there's a legitimate way to do it without resorting to hacks...

Thanks.

@Bunny83

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

4 Replies

· Add your reply
  • Sort: 
avatar image
6

Answer by Syganek · Mar 02, 2018 at 05:17 PM

There is IPreprocessBuild interface.

It contains OnPreprocessBuild method that will be invoked.

I know it is old topic, but I think that answers should be given when somebody knows them and stumbles upon a question.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image vivekhash · Apr 30, 2018 at 02:28 PM 0
Share

Thank You. It saved my day.

avatar image ferretnt · Apr 30, 2018 at 04:02 PM 0
Share

Yes, this was added some time in 2017.x, and we've moved all our custom builds to use it. It works very well. It had strangely little fanfare on its addition - I found it by mistake sometime after posting my answer in a blog (not on the official unity blog) by a Unity engineer called something like "10 things you didn't know about that weren't highlighted in the big feature release announcements of 2017.x".) Those 10 things turned out to be more interesting to me than most of the big ticket features.

avatar image
2

Answer by Dave-Carlile · Jun 16, 2016 at 03:08 PM

The BuildPipeline class will let you have some control over the build process.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image vexe · Jun 16, 2016 at 03:24 PM 0
Share

Thanks. Will look into that. I need to somehow access the options that show up in the inspector when you click the 'Player Options' button. Should be easy to find out with ILSpy

avatar image
1

Answer by ferretnt · May 29, 2017 at 11:25 PM

As far as I know, there's still no "pre-build event", and custom scripting buildPipeline is more of a pain than it's ever worth, especially after you've tried to manage it so your script does what you want across multiple platforms, local dev builds, a continuous build machine, release process etc.

"Use the buildpipeline class" is similar to "use assetbundles instead of just loading a single level." It totally gives you that control, at the expense of breaking almost every advantage of simplicity and workflow that made you use Unity in the first place.

The closest we've every got is a manually invoked "set everything up" editor script, that sets values in PlayerSettings, so you can THEN run your regular build process with ctrl-b.

You can use post build events to fudge up your XCodeProj for stuff like version numbers after the build but there's not really any way to do anything useful on Android.

Unfortunately, exact requirements around build process are very project specific, and the Unity core team does an excellent job of ignoring problems with ambiguous requirements.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by neuroKip · Apr 12, 2019 at 03:00 PM

Since 2017.1 it is now possible to override the Build and Build and Run Buttons.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

52 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Build to Android with a Wireless connection? 1 Answer

Distribute terrain in zones 3 Answers

Is it possible to set android sdk path via script? 1 Answer

Change Plugin platforms by scripting 4 Answers

How to fix bugs that only appear in the build? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges