首页 > 解决方案 > 如何在 Travis Ci 中使用 Unity 项目?

问题描述

我正在遵循本指南:

https://jonathan.porta.codes/2015/04/17/automatically-build-your-unity3d-project-in-the-cloud-using-travisci-for-free/

我想做的是用 Travic Ci 测试一个统一项目。我一直在努力让它发挥作用。Maybi 这里有人知道它是如何工作的,但效果不是很好。我不知道如何解决这个问题。我一直遇到同样的错误,例如:

$ ./scripts/install.sh
Downloading from http://netstorage.unity3d.com/unity/3757309da7e7/MacEditorInstaller/Unity-5.2.2f1.pkg: 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    16  100    16    0     0    774      0 --:--:-- --:--:-- --:--:--   761
Installing Unity.pkg
installer: Error the package path specified was invalid: 'Unity.pkg'.
install: editor,: No such file or directory
install: windowssupport,: No such file or directory
install: linuxsupport,: No such file or directory
The command "./scripts/install.sh" failed and exited with 71 during .
Your build has been stopped.

这是我的脚本文件 install.sh:

#! /bin/sh

# Example install script for Unity3D project. See the entire example: https://github.com/JonathanPorta/ci-build

# This link changes from time to time. I haven't found a reliable hosted installer package for doing regular
# installs like this. You will probably need to grab a current link from: http://unity3d.com/get-unity/download/archive
echo 'Downloading from http://netstorage.unity3d.com/unity/3757309da7e7/MacEditorInstaller/Unity-5.2.2f1.pkg: '
curl -o Unity.pkg http://netstorage.unity3d.com/unity/3757309da7e7/MacEditorInstaller/Unity-5.2.2f1.pkg

echo 'Installing Unity.pkg'
sudo installer -dumplog -package Unity.pkg -target /

这是我的 build.sh 文件:

#! /bin/sh

# Example build script for Unity3D project. See the entire example: https://github.com/JonathanPorta/ci-build

# Change this the name of your project. This will be the name of the final executables as well.
project="ci-build"

echo "Attempting to build $project for Windows"
/Applications/Unity/Unity.app/Contents/MacOS/Unity \
  -batchmode \
  -nographics \
  -silent-crashes \
  -logFile $(pwd)/unity.log \
  -projectPath $(pwd) \
  -buildWindowsPlayer "$(pwd)/Build/windows/$project.exe" \
  -quit

echo "Attempting to build $project for OS X"
/Applications/Unity/Unity.app/Contents/MacOS/Unity \
  -batchmode \
  -nographics \
  -silent-crashes \
  -logFile $(pwd)/unity.log \
  -projectPath $(pwd) \
  -buildOSXUniversalPlayer "$(pwd)/Build/osx/$project.app" \
  -quit

echo "Attempting to build $project for Linux"
/Applications/Unity/Unity.app/Contents/MacOS/Unity \
  -batchmode \
  -nographics \
  -silent-crashes \
  -logFile $(pwd)/unity.log \
  -projectPath $(pwd) \
  -buildLinuxUniversalPlayer "$(pwd)/Build/linux/$project.exe" \
  -quit

echo 'Logs from build'
cat $(pwd)/unity.log

我希望有人可以帮助我解决这个问题!?谢谢。

标签: unity3dshtravis-cipipeline

解决方案


看一下日志:

Installing Unity.pkg
installer: Error the package path specified was invalid: 'Unity.pkg'.
install: editor,: No such file or directory

似乎问题出在 UnityInstaller 上。在您尝试下载的脚本中Unity-5.2.2f1.pkg。如果您转到该地址,您将看到请求的文件在该 URL 上不存在。

curl http://netstorage.unity3d.com/unity/3757309da7e7/MacEditorInstaller/Unity-5.2.2f1.pkg

File not found."

这是你必须解决的第一个问题。

现在,Unity 5.2 是一个相当旧的版本,并且该教程是在2015 年 4 月 17 日编写的,我建议用更新的教程来补充该教程。


推荐阅读