I consulted the following blogs for an example of setting the BuildOptions and Player
https://www.blog.radiator.debacle.us/2015/09/scripting-unity-editor-to-automatically.html
and
https://www.gamasutra.com/blogs/EnriqueJGil/20160808/278440/Unity_Builds_Scripting_Basic_and_advanced_possibilities.php
My script in pseudo code:
[menu button attribute marker]
void BuildFlockOfDogsAndZipItUp ()
{
DoBuild ("Windows");
DoBuild ("Mac");
DoBuild ("Linux");
ClearFoldersFromDropboxFolder ();
ZipNewBuildsAndMoveThemToDropboxFolder ();
}
I'll present the guts, then, if you're particularly interested, I'll talk through the journey!
NOTE: WARNING: LOOK AT THIS: If you're not used to writing editor scripts, make sure your script is in a folder in your Assets that is titled Editor.
Starting with the import directives / whatever they're called:
Next, basically, a translation of my pseudo code into C# syntax:
Let's go in order! What does FormatDate() do, you think? It formats the date the way I like it. (It's important that I save the dateStamp string so that I can successfully identify the build folders later when I'm zipping them up.) So here it is:
Next, the BuildPlayer() function is basically mimicking the things you have to/can do when you click File->Build from inside the Unity editor: And this is the function that takes forever, because it's where Unity actually builds the project. Each time it switches the active build target, it takes a while, and each time it actually builds the thing, it takes a while. So as you might have guessed, debugging this function is delicate and can take a while. So edit it with care:
It's a cinch! So, next (if you scroll up and look back at the pseudo code), I want to move anything that's in my Dropbox folder out of the Dropbox folder:
And finally, the zipping function
fdsad fasf asd asf t wadg fsf aw
(THE SECRET TO THE ZIPPING WILL BE COVERED IN THE NEXT BLOG BC IT WAS TRICKY-WICKY-DO. THIS WON'T JUST work FOR MANY USERS)
dfskjl kj; joi jlkj poj 'lkj 'lkj' pj'oj 'lj 'j
Voila.
And for reference, the whole shebang, BuildFlockOfDogs.cs:
*******************************************************
**********************************************
***************************
********
***
*
***
*********
****************
**********************
******************
*********************
****************
***********
****
**********
************************************
**************************************************************
***********
******************************************
***
*
**
***
*
***************
********
Anyway. If you want to now hear about my struggle with zipping, read the next post!
[BONUS: QUICK SNIP TIP: (Secret: I'm just using the Windows snipping tool to get these code snippets and then dropping them in as .pngs instead of doing all the super tedious work arounds for formatting/embedding code snippets and sometimes i like to turn on all the formatting options and it's also like when you read something with strikethrough on, you feel like you found a secret maybe and if the feeling of finding a secret is different than actually finding a secret then i don't know what is.)][]}}}{}!!!!!!!!!!!!!!!!!!!!
No comments:
Post a Comment