浏览代码

Added CustomBuild scripts to deploy easily test scenes to devices.

/Branch_batcher
Felipe Lira 8 年前
当前提交
3373c4a1
共有 4 个文件被更改,包括 99 次插入0 次删除
  1. 62
      Assets/GraphicsTests/Editor/TestFrameworkCustomBuild.cs
  2. 12
      Assets/GraphicsTests/Editor/TestFrameworkCustomBuild.cs.meta
  3. 13
      Assets/GraphicsTests/GotoNextScene.cs
  4. 12
      Assets/GraphicsTests/GotoNextScene.cs.meta

62
Assets/GraphicsTests/Editor/TestFrameworkCustomBuild.cs


using System.IO;
using UnityEngine;
using UnityEditor.SceneManagement;
using UnityEditor;
namespace UnityEditor.Experimental.Rendering
{
public class TestFrameworkCustomBuild
{
private static readonly string s_TestSceneFolder = "/GraphicsTests/Scenes";
private static readonly string s_BuildFolder = "/TestScenesBuild";
[MenuItem("RenderPipeline/TestFramework/Build-iOS")]
public static void BuildiOS()
{
TestFrameworkCustomBuild builder = new TestFrameworkCustomBuild();
builder.Build(BuildTarget.iOS, BuildOptions.AcceptExternalModificationsToPlayer);
}
public void Build(BuildTarget target, BuildOptions options)
{
var absoluteScenesPath = Application.dataPath + s_TestSceneFolder;
string[] levels = System.IO.Directory.GetFiles(absoluteScenesPath, "*.unity", System.IO.SearchOption.AllDirectories);
CheckAndAddGotoNextSceneBehavior(levels);
string savePath = EditorUtility.SaveFolderPanel("Select folder to save project", "", "");
BuildPipeline.BuildPlayer(levels, savePath + s_BuildFolder, target, options);
}
private void CheckAndAddGotoNextSceneBehavior(string[] levels)
{
for (int i = 0; i < levels.Length; ++i)
{
string levelPath = levels[i];
var scene = EditorSceneManager.OpenScene(levelPath);
GameObject[] objects = scene.GetRootGameObjects();
bool componentFound = false;
foreach (GameObject go in objects)
{
GotoNextScene component = go.GetComponent<GotoNextScene>();
if (component != null)
{
component.m_NextSceneIndex = (i + 1) % levels.Length;
componentFound = true;
break;
}
}
if (!componentFound)
{
GameObject gotoNextScene = new GameObject("GotoNextScene");
GotoNextScene component = gotoNextScene.AddComponent<GotoNextScene>();
component.m_NextSceneIndex = (i + 1) % levels.Length;
}
EditorSceneManager.SaveScene(scene);
EditorSceneManager.UnloadSceneAsync(scene);
}
}
}
}

12
Assets/GraphicsTests/Editor/TestFrameworkCustomBuild.cs.meta


fileFormatVersion: 2
guid: 5e43c15f4f8ef4a6a82779e179ae97b3
timeCreated: 1493801452
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

13
Assets/GraphicsTests/GotoNextScene.cs


using UnityEngine;
using UnityEngine.SceneManagement;
public class GotoNextScene : MonoBehaviour
{
public int m_NextSceneIndex = 0;
void Update()
{
if (Input.touchCount == 1 && Input.GetTouch(0).phase == TouchPhase.Began)
SceneManager.LoadScene(m_NextSceneIndex);
}
}

12
Assets/GraphicsTests/GotoNextScene.cs.meta


fileFormatVersion: 2
guid: b96aad4b8199e42ae887b72c26bc8a58
timeCreated: 1493732883
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存