Want to make cloud build functionality in Unity.
How can I do it in Unity from script(in EditorWindow)?
Update: Found Pre- and post-export methods, but still can't find the way to execute cloud build...
1 Answer
One way to execute a cloud build programmatically is to use Unity's Cloud Build API.
The API documentation is available here, and the build command itself is here
Their example for making the call via curl is
curl
-X POST
-d '{"clean": true, "delay": 30}'
-H "Content-Type: application/json"
-H "Authorization: Basic [YOUR API KEY]"
https://build-api.cloud.unity3d.com/api/v1/orgs/{orgid}/projects/{projectid}/buildtargets/{buildtargetid}/builds
Making web service calls from Unity is probably a separate question, but has ample documentation online.
BuildPipeline
doesn't seem to offer cloud functionality, yet.
CloudProjectSettings
may streamline your efforts a bit, if you're trying to kick off a build for the currently open project.
-
\$\begingroup\$ and what about BuildSettings? is Unity sending them from BuildSettings into cloud? and can you share some example of "but has ample documentation online"? All I want to do is generate cloud build from UnityEdor in my custom EditorWindow. \$\endgroup\$– DMapCommented Jul 12, 2018 at 7:10
-
\$\begingroup\$ As far as I know Unity doesn't provide a special programmatic way to access cloud build services from within Unity, so there isn't a simple "All I want to do..." approach. BuildSettings I believe are handled via the
buildtargets
endpoint. By documentation I mean that it's the same as any other webservice call you might make from Unity, i.e., google 'unity webservice call' and dig around. I don't have an active cloud build account so I can't offer sample code, sorry. \$\endgroup\$ Commented Jul 12, 2018 at 8:16