Upgraded original RothenburgAR to Unity version 2017.4.5f1 (and upgrading from standalone vuforia to the version integrated in unity)

This commit is contained in:
2018-08-03 15:43:36 +02:00
parent 64f296a0aa
commit 13041e7a70
738 changed files with 592316 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 59c71df8bbeda4a1a994a635b0aa6675
timeCreated: 1431456701
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,30 @@
using UnityEngine;
using UnityEditor;
using System.Collections;
namespace AssetBundles
{
public class AssetBundlesMenuItems
{
const string kSimulationMode = "Assets/AssetBundles/Simulation Mode";
[MenuItem(kSimulationMode)]
public static void ToggleSimulationMode ()
{
AssetBundleManager.SimulateAssetBundleInEditor = !AssetBundleManager.SimulateAssetBundleInEditor;
}
[MenuItem(kSimulationMode, true)]
public static bool ToggleSimulationModeValidate ()
{
Menu.SetChecked(kSimulationMode, AssetBundleManager.SimulateAssetBundleInEditor);
return true;
}
[MenuItem ("Assets/AssetBundles/Build AssetBundles")]
static public void BuildAssetBundles ()
{
BuildScript.BuildAssetBundles();
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 0906f670aa52147688cf79b1e471f36d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:

View File

@@ -0,0 +1,161 @@
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Sockets;
namespace AssetBundles
{
public class BuildScript
{
public static string overloadedDevelopmentServerURL = "";
public static void BuildAssetBundles()
{
// Choose the output path according to the build target.
string outputPath = Path.Combine(Utility.AssetBundlesOutputPath, Utility.GetPlatformName());
if (!Directory.Exists(outputPath) )
Directory.CreateDirectory (outputPath);
//@TODO: use append hash... (Make sure pipeline works correctly with it.)
BuildPipeline.BuildAssetBundles (outputPath, BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget);
}
public static void WriteServerURL()
{
string downloadURL;
if (string.IsNullOrEmpty(overloadedDevelopmentServerURL) == false)
{
downloadURL = overloadedDevelopmentServerURL;
}
else
{
IPHostEntry host;
string localIP = "";
host = Dns.GetHostEntry(Dns.GetHostName());
foreach (IPAddress ip in host.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
localIP = ip.ToString();
break;
}
}
downloadURL = "http://"+localIP+":7888/";
}
string assetBundleManagerResourcesDirectory = "Assets/AssetBundleManager/Resources";
string assetBundleUrlPath = Path.Combine (assetBundleManagerResourcesDirectory, "AssetBundleServerURL.bytes");
Directory.CreateDirectory(assetBundleManagerResourcesDirectory);
File.WriteAllText(assetBundleUrlPath, downloadURL);
AssetDatabase.Refresh();
}
public static void BuildPlayer()
{
var outputPath = EditorUtility.SaveFolderPanel("Choose Location of the Built Game", "", "");
if (outputPath.Length == 0)
return;
string[] levels = GetLevelsFromBuildSettings();
if (levels.Length == 0)
{
Debug.Log("Nothing to build.");
return;
}
string targetName = GetBuildTargetName(EditorUserBuildSettings.activeBuildTarget);
if (targetName == null)
return;
// Build and copy AssetBundles.
BuildScript.BuildAssetBundles();
WriteServerURL();
BuildOptions option = EditorUserBuildSettings.development ? BuildOptions.Development : BuildOptions.None;
BuildPipeline.BuildPlayer(levels, outputPath + targetName, EditorUserBuildSettings.activeBuildTarget, option);
}
public static void BuildStandalonePlayer()
{
var outputPath = EditorUtility.SaveFolderPanel("Choose Location of the Built Game", "", "");
if (outputPath.Length == 0)
return;
string[] levels = GetLevelsFromBuildSettings();
if (levels.Length == 0)
{
Debug.Log("Nothing to build.");
return;
}
string targetName = GetBuildTargetName(EditorUserBuildSettings.activeBuildTarget);
if (targetName == null)
return;
// Build and copy AssetBundles.
BuildScript.BuildAssetBundles();
BuildScript.CopyAssetBundlesTo(Path.Combine(Application.streamingAssetsPath, Utility.AssetBundlesOutputPath) );
AssetDatabase.Refresh();
BuildOptions option = EditorUserBuildSettings.development ? BuildOptions.Development : BuildOptions.None;
BuildPipeline.BuildPlayer(levels, outputPath + targetName, EditorUserBuildSettings.activeBuildTarget, option);
}
public static string GetBuildTargetName(BuildTarget target)
{
switch(target)
{
case BuildTarget.Android :
return "/test.apk";
case BuildTarget.StandaloneWindows:
case BuildTarget.StandaloneWindows64:
return "/test.exe";
case BuildTarget.StandaloneOSX:
return "/test.app";
case BuildTarget.WebGL:
return "";
// Add more build targets for your own.
default:
Debug.Log("Target not implemented.");
return null;
}
}
static void CopyAssetBundlesTo(string outputPath)
{
// Clear streaming assets folder.
FileUtil.DeleteFileOrDirectory(Application.streamingAssetsPath);
Directory.CreateDirectory(outputPath);
string outputFolder = Utility.GetPlatformName();
// Setup the source folder for assetbundles.
var source = Path.Combine(Path.Combine(System.Environment.CurrentDirectory, Utility.AssetBundlesOutputPath), outputFolder);
if (!System.IO.Directory.Exists(source) )
Debug.Log("No assetBundle output folder, try to build the assetBundles first.");
// Setup the destination folder for assetbundles.
var destination = System.IO.Path.Combine(outputPath, outputFolder);
if (System.IO.Directory.Exists(destination) )
FileUtil.DeleteFileOrDirectory(destination);
FileUtil.CopyFileOrDirectory(source, destination);
}
static string[] GetLevelsFromBuildSettings()
{
List<string> levels = new List<string>();
for(int i = 0 ; i < EditorBuildSettings.scenes.Length; ++i)
{
if (EditorBuildSettings.scenes[i].enabled)
levels.Add(EditorBuildSettings.scenes[i].path);
}
return levels.ToArray();
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: f19ef23648157ec49ab02b99bee74403
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:

View File

@@ -0,0 +1,128 @@
using UnityEditor;
using UnityEngine;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System;
namespace AssetBundles
{
class MonoInstallationFinder
{
public static string GetFrameWorksFolder()
{
var editorAppPath = EditorApplication.applicationPath;
if (Application.platform == RuntimePlatform.WindowsEditor)
return Path.Combine(Path.GetDirectoryName(editorAppPath), "Data");
else if (Application.platform == RuntimePlatform.OSXEditor)
return Path.Combine(editorAppPath, Path.Combine("Contents", "Frameworks"));
else // Linux...?
return Path.Combine(Path.GetDirectoryName(editorAppPath), "Data");
}
public static string GetProfileDirectory (BuildTarget target, string profile)
{
var monoprefix = GetMonoInstallation();
return Path.Combine(monoprefix, Path.Combine("lib", Path.Combine("mono", profile)));
}
public static string GetMonoInstallation()
{
#if INCLUDE_MONO_2_12
return GetMonoInstallation("MonoBleedingEdge");
#else
return GetMonoInstallation("Mono");
#endif
}
public static string GetMonoInstallation(string monoName)
{
return Path.Combine(GetFrameWorksFolder(), monoName);
}
}
class ExecuteInternalMono
{
private static readonly Regex UnsafeCharsWindows = new Regex("[^A-Za-z0-9\\_\\-\\.\\:\\,\\/\\@\\\\]");
private static readonly Regex UnescapeableChars = new Regex("[\\x00-\\x08\\x10-\\x1a\\x1c-\\x1f\\x7f\\xff]");
private static readonly Regex Quotes = new Regex("\"");
public ProcessStartInfo processStartInfo = null;
public static string PrepareFileName(string input)
{
if (Application.platform == RuntimePlatform.OSXEditor)
{
return EscapeCharsQuote(input);
}
return EscapeCharsWindows(input);
}
public static string EscapeCharsQuote(string input)
{
if (input.IndexOf('\'') == -1)
{
return "'" + input + "'";
}
if (input.IndexOf('"') == -1)
{
return "\"" + input + "\"";
}
return null;
}
public static string EscapeCharsWindows(string input)
{
if (input.Length == 0)
{
return "\"\"";
}
if (UnescapeableChars.IsMatch(input))
{
UnityEngine.Debug.LogWarning("Cannot escape control characters in string");
return "\"\"";
}
if (UnsafeCharsWindows.IsMatch(input))
{
return "\"" + Quotes.Replace(input, "\"\"") + "\"";
}
return input;
}
public static ProcessStartInfo GetProfileStartInfoForMono(string monodistribution, string profile, string executable, string arguments, bool setMonoEnvironmentVariables)
{
var monoexe = PathCombine(monodistribution, "bin", "mono");
var profileAbspath = PathCombine(monodistribution, "lib", "mono", profile);
if (Application.platform == RuntimePlatform.WindowsEditor)
monoexe = PrepareFileName(monoexe + ".exe");
var startInfo = new ProcessStartInfo
{
Arguments = PrepareFileName(executable) + " " + arguments,
CreateNoWindow = true,
FileName = monoexe,
RedirectStandardError = true,
RedirectStandardOutput = true,
WorkingDirectory = Application.dataPath + "/..",
UseShellExecute = false
};
if (setMonoEnvironmentVariables)
{
startInfo.EnvironmentVariables["MONO_PATH"] = profileAbspath;
startInfo.EnvironmentVariables["MONO_CFG_DIR"] = PathCombine(monodistribution, "etc");
}
return startInfo;
}
static string PathCombine(params string[] parts)
{
var path = parts[0];
for (var i = 1; i < parts.Length; ++i)
path = Path.Combine(path, parts[i]);
return path;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8127c6674aa9d419ebdf60f64e3bfbb9
timeCreated: 1431509895
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,99 @@
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System;
using System.Net;
using System.Threading;
using UnityEditor.Utils;
namespace AssetBundles
{
internal class LaunchAssetBundleServer : ScriptableSingleton<LaunchAssetBundleServer>
{
const string kLocalAssetbundleServerMenu = "Assets/AssetBundles/Local AssetBundle Server";
[SerializeField]
int m_ServerPID = 0;
[MenuItem (kLocalAssetbundleServerMenu)]
public static void ToggleLocalAssetBundleServer ()
{
bool isRunning = IsRunning();
if (!isRunning)
{
Run ();
}
else
{
KillRunningAssetBundleServer ();
}
}
[MenuItem (kLocalAssetbundleServerMenu, true)]
public static bool ToggleLocalAssetBundleServerValidate ()
{
bool isRunnning = IsRunning ();
Menu.SetChecked(kLocalAssetbundleServerMenu, isRunnning);
return true;
}
static bool IsRunning ()
{
if (instance.m_ServerPID == 0)
return false;
var process = Process.GetProcessById (instance.m_ServerPID);
if (process == null)
return false;
return !process.HasExited;
}
static void KillRunningAssetBundleServer ()
{
// Kill the last time we ran
try
{
if (instance.m_ServerPID == 0)
return;
var lastProcess = Process.GetProcessById (instance.m_ServerPID);
lastProcess.Kill();
instance.m_ServerPID = 0;
}
catch
{
}
}
static void Run ()
{
string pathToAssetServer = Path.Combine(Application.dataPath, "AssetBundleManager/Editor/AssetBundleServer.exe");
string pathToApp = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf('/'));
KillRunningAssetBundleServer();
BuildScript.WriteServerURL();
string args = Path.Combine (pathToApp, "AssetBundles");
args = string.Format("\"{0}\" {1}", args, Process.GetCurrentProcess().Id);
ProcessStartInfo startInfo = ExecuteInternalMono.GetProfileStartInfoForMono(MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"), "4.0", pathToAssetServer, args, true);
startInfo.WorkingDirectory = Path.Combine(System.Environment.CurrentDirectory, "AssetBundles");
startInfo.UseShellExecute = false;
Process launchProcess = Process.Start(startInfo);
if (launchProcess == null || launchProcess.HasExited == true || launchProcess.Id == 0)
{
//Unable to start process
UnityEngine.Debug.LogError ("Unable Start AssetBundleServer process");
}
else
{
//We seem to have launched, let's save the PID
instance.m_ServerPID = launchProcess.Id;
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 23a84bb10f0e2473bbe44fcb9c23e157
timeCreated: 1429472835
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: