{"id":54859,"date":"2022-08-10T23:31:19","date_gmt":"2022-08-10T21:31:19","guid":{"rendered":"https:\/\/www.elwinlee.com\/blog\/?p=54859"},"modified":"2022-08-10T23:31:19","modified_gmt":"2022-08-10T21:31:19","slug":"unity3d-development_build-not-working-in-prebuild-script-ipreprocessbuildwithreport","status":"publish","type":"post","link":"https:\/\/www.elwinlee.com\/blog\/unity3d-development_build-not-working-in-prebuild-script-ipreprocessbuildwithreport\/","title":{"rendered":"[Unity3D] #DEVELOPMENT_BUILD not working in PreBuild Script IPreprocessBuildWithReport"},"content":{"rendered":"<p>I was trying to get some logic to work in a PreBuild script whether the build is a development build or not using the define symbol #DEVELOPMENT_BUILD. It works in regular scripts, but apparently it doesn&#8217;t work for PreBuild scripts because the symbol won&#8217;t be defined until the build actually starts. So the #DEVELOPMENT_BUILD never actually hits even though you have &#8220;Development Build&#8221; checked in the Build Settings.<\/p>\n<p>To check whether or not your build is a development build use:<\/p>\n<pre class=\"lang:javascript\">var isDev = (report.summary.options &amp; BuildOptions.Development) != 0;\r\n<\/pre>\n<p>In the PreBuild script it would look like this:<\/p>\n<pre class=\"lang:javascript\">public void OnPreprocessBuild(BuildReport report)\r\n{\r\n\u00a0 \u00a0var isDev = (report.summary.options &amp; BuildOptions.Development) != 0;\r\n\r\n\u00a0 \u00a0if (isDev) {\r\n\u00a0 \u00a0 \/\/ Is development build\r\n\u00a0 \u00a0} else {\r\n\u00a0 \u00a0 \/\/ Normal build\r\n\u00a0 \u00a0}\r\n}<\/pre>\n<p>Source:\u00a0<a href=\"https:\/\/qiita.com\/Clpsplug\/items\/c34e8f596e54444623ba\">https:\/\/qiita.com\/Clpsplug\/items\/c34e8f596e54444623ba<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was trying to get some logic to work in a PreBuild script whether the build is a development build [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":54864,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2542,1079,255],"tags":[2009,2010,2222,2407,2510,2567,2568,2569,2570],"class_list":["post-54859","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coding","category-how-to-fix-stuff","category-technology","tag-unity3d","tag-unity","tag-script","tag-development","tag-build","tag-development_build","tag-development-build","tag-prebuild","tag-ipreprocessbuildwithreport"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/www.elwinlee.com\/blog\/wp-content\/uploads\/2022\/08\/logo-unity-web.webp","jetpack_shortlink":"https:\/\/wp.me\/p1mtRf-egP","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/posts\/54859","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/comments?post=54859"}],"version-history":[{"count":4,"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/posts\/54859\/revisions"}],"predecessor-version":[{"id":54863,"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/posts\/54859\/revisions\/54863"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/media\/54864"}],"wp:attachment":[{"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/media?parent=54859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/categories?post=54859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.elwinlee.com\/blog\/wp-json\/wp\/v2\/tags?post=54859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}