本文整理汇总了C#中BuildTarget.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# BuildTarget.ToString方法的具体用法?C# BuildTarget.ToString怎么用?C# BuildTarget.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BuildTarget
的用法示例。
在下文中一共展示了BuildTarget.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnPostprocessBuild
public static void OnPostprocessBuild(BuildTarget buildTarget, string buildPath) {
// BuiltTarget.iOS is not defined in Unity 4, so we just use strings here
if (buildTarget.ToString () == "iOS" || buildTarget.ToString () == "iPhone") {
PrepareProject (buildPath);
PreparePlist (buildPath);
}
}
示例2: OnPostProcessBuild
public static void OnPostProcessBuild(BuildTarget target, string path)
{
// If integrating with facebook on any platform, throw a warning if the app id is invalid
if (!Facebook.Unity.FacebookSettings.IsValidAppId)
{
Debug.LogWarning("You didn't specify a Facebook app ID. Please add one using the Facebook menu in the main Unity editor.");
}
// Unity renamed build target from iPhone to iOS in Unity 5, this keeps both versions happy
if (target.ToString() == "iOS" || target.ToString() == "iPhone")
{
UpdatePlist(path);
FixupFiles.FixSimulator(path);
FixupFiles.AddVersionDefine(path);
FixupFiles.FixColdStart(path);
}
if (target == BuildTarget.Android)
{
// The default Bundle Identifier for Unity does magical things that causes bad stuff to happen
if (PlayerSettings.bundleIdentifier == "com.Company.ProductName")
{
Debug.LogError("The default Unity Bundle Identifier (com.Company.ProductName) will not work correctly.");
}
if (!FacebookAndroidUtil.IsSetupProperly())
{
Debug.LogError("Your Android setup is not correct. See Settings in Facebook menu.");
}
if (!ManifestMod.CheckManifest())
{
// If something is wrong with the Android Manifest, try to regenerate it to fix it for the next build.
ManifestMod.GenerateManifest();
}
}
}
示例3: VerifyAssembly
protected bool VerifyAssembly(BuildTarget target, string assembly)
{
if ((this.m_UnsupportedAssemblies.ContainsKey("*") && this.m_UnsupportedAssemblies["*"].Contains(assembly)) || (this.m_UnsupportedAssemblies.ContainsKey(target.ToString()) && this.m_UnsupportedAssemblies[target.ToString()].Contains(assembly)))
{
return false;
}
return true;
}
示例4: OnPostprocessBuild
static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
if (LunarConsoleSettings.consoleEnabled)
{
if (target.ToString() == "iOS" || target.ToString() == "iPhone")
{
OnPostprocessIOS(pathToBuiltProject);
}
}
}
示例5: OnPostprocessBuild
public static void OnPostprocessBuild(BuildTarget buildTarget, string buildPath)
{
if (!IsKitOnboarded ("Crashlytics")) {
Fabric.Internal.Editor.Utils.Warn ("Crashlytics not yet onboarded, skipping post-build steps.");
return;
}
// BuiltTarget.iOS is not defined in Unity 4, so we just use strings here
if (buildTarget.ToString () == "iOS" || buildTarget.ToString () == "iPhone") {
CheckiOSVersion ();
PrepareProject (buildPath);
PreparePlist (buildPath);
}
}
示例6: OnPostprocessBuild
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
if(target.ToString()=="StandaloneWindows"){
string gmlFileName = "my_gestures.gml";
string coreDllFileName = "GestureworksCore32.dll";
string pathToNewDataFolder = "";
string pathToAssetsFolder = UnityEngine.Application.dataPath;
pathToAssetsFolder = pathToAssetsFolder.Replace("/", "\\");
//destination /Bin folder
string[] pathPieces = pathToBuiltProject.Split("/".ToCharArray() );
string exeName = pathPieces[pathPieces.Length-1];
exeName = exeName.Trim(".exe".ToCharArray()); // extract the name of the exe to use with the name of the data folder
for(int i=1; i<pathPieces.Length; i++){
pathToNewDataFolder += pathPieces[i-1]+"\\"; // this will grab everything except for the last
}
pathToNewDataFolder += exeName+"_Data\\";
//Debug.Log("pathToAssetsFolder: "+pathToAssetsFolder);
//Debug.Log("pathToNewDataFolder: "+pathToNewDataFolder);
//PostBuildProcessor window = EditorWindow.GetWindow<PostBuildProcessor> ("Post Build Options");
FileUtil.CopyFileOrDirectory(pathToAssetsFolder+"\\MyScripts\\"+gmlFileName, pathToNewDataFolder+gmlFileName);
FileUtil.CopyFileOrDirectory(pathToAssetsFolder+"\\Plugins\\Gestureworks\\Core\\"+coreDllFileName, pathToNewDataFolder+coreDllFileName);
} else {
//Debug.Log("Only the Windows platform is supported only with Gestureworks");
}
}
示例7: OnPostProcessBuild
public static void OnPostProcessBuild( BuildTarget target, string pathToBuiltProject )
{
string _targetStr = target.ToString();
if (!(_targetStr.Equals("iOS") || _targetStr.Equals("iPhone")))
{
Debug.LogWarning("Target is not iPhone. XCodePostProcess will not run");
return;
}
// Create a new project object from build target
XCProject project = new XCProject( pathToBuiltProject );
// Find and run through all xcodemods files to patch the project.
// Please pay attention that ALL xcodemods files in your project folder will be excuted!
string[] files = Directory.GetFiles( Utility.AssetsUtility.GetProjectPath(), "*.xcodemods", SearchOption.AllDirectories );
foreach( string file in files ) {
UnityEngine.Debug.Log("Xcodemods File: "+file);
project.ApplyMod( file );
}
//TODO implement generic settings as a module option
// project.overwriteBuildSetting("CODE_SIGN_IDENTITY[sdk=iphoneos*]", "iPhone Distribution", "Release");
// Finally save the xcode project
project.Save();
}
示例8: ChangePlatform
public static void ChangePlatform(BuildTarget desiredPlatform)
{
if (!EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
{
// They hit cancel in the save dialog
return;
}
if (ProjenyEditorUtil.GetPlatformFromDirectoryName() == desiredPlatform)
{
UnityEngine.Debug.Log("Projeny: Already at the desired platform, no need to change project.");
return;
}
var result = PrjInterface.RunPrj(PrjInterface.CreatePrjRequestForPlatform("updateLinks", desiredPlatform));
if (result.Succeeded)
{
result = PrjInterface.RunPrj(PrjInterface.CreatePrjRequestForPlatform("openUnity", desiredPlatform));
}
if (result.Succeeded)
{
EditorApplication.Exit(0);
}
else
{
DisplayPrjError(
"Changing platform to '{0}'"
.Fmt(desiredPlatform.ToString()), result.ErrorMessage);
}
}
示例9: BuildBundles
private static void BuildBundles(BuildTarget target)
{
BuildAssetBundleOptions assetBundleOptions = BuildAssetBundleOptions.DeterministicAssetBundle;
string path = DirectoryUtility.AssetBundles() + "/" + target.ToString();
Directory.CreateDirectory(path);
BuildPipeline.BuildAssetBundles(path, assetBundleOptions, target);
}
示例10: OnPostProcessBuild
public static void OnPostProcessBuild(BuildTarget target, string path)
{
// If integrating with facebook on any platform, throw a warning if the app id is invalid
if (!FBSettings.IsValidAppId)
{
Debug.LogWarning("You didn't specify a Facebook app ID. Please add one using the Facebook menu in the main Unity editor.");
}
// Unity renamed build target from iPhone to iOS in Unity 5, this keeps both versions happy
if (target.ToString() == "iOS" || target.ToString() == "iPhone")
{
UnityEditor.XCodeEditor.XCProject project = new UnityEditor.XCodeEditor.XCProject(path);
// Find and run through all projmods files to patch the project
string projModPath = System.IO.Path.Combine(Application.dataPath, "Facebook/Editor/iOS");
var files = System.IO.Directory.GetFiles(projModPath, "*.projmods", System.IO.SearchOption.AllDirectories);
foreach (var file in files)
{
project.ApplyMod(Application.dataPath, file);
}
project.Save();
UpdatePlist(path);
FixupFiles.FixSimulator(path);
FixupFiles.AddVersionDefine(path);
FixupFiles.FixColdStart(path);
}
if (target == BuildTarget.Android)
{
// The default Bundle Identifier for Unity does magical things that causes bad stuff to happen
if (PlayerSettings.bundleIdentifier == "com.Company.ProductName")
{
Debug.LogError("The default Unity Bundle Identifier (com.Company.ProductName) will not work correctly.");
}
if (!FacebookAndroidUtil.IsSetupProperly())
{
Debug.LogError("Your Android setup is not correct. See Settings in Facebook menu.");
}
if (!ManifestMod.CheckManifest())
{
// If something is wrong with the Android Manifest, try to regenerate it to fix it for the next build.
ManifestMod.GenerateManifest();
}
}
}
示例11: BuildBundle
static void BuildBundle(string path, BuildTarget target)
{
if (!Directory.Exists (path))
Directory.CreateDirectory (path);
BuildPipeline.BuildAssetBundles (path, BuildAssetBundleOptions.None, target);
Debug.Log (target.ToString ());
}
示例12: BuildPlayer
string BuildPlayer(BuildTarget target, BuildOptions options, params string[] levels)
{
var output = Path.Combine(OutputDir, target.ToString());
DirectoryEx.DeleteDirectory(output);
BuildPipeline.BuildPlayer(levels, output, target, options);
return output;
}
示例13: DrawPlatformToggle
private void DrawPlatformToggle(BuildTarget target, string label)
{
// We try to make a unique key for this EditorPref variable
string key = Prefix + target.ToString ();
// We define false the default value of the EditorPref if this is not defined
bool currentValue = EditorPrefs.GetBool (key, false);
EditorPrefs.SetBool (key, GUILayout.Toggle (currentValue, label));
}
示例14: OnPostProcessBuild
public static void OnPostProcessBuild (BuildTarget _target, string _buildPath)
{
string _targetStr = _target.ToString();
if (_targetStr.Equals ("iOS") || _targetStr.Equals ("iPhone"))
{
iOSPostProcessBuild (_target, _buildPath);
return;
}
}
示例15: OnPostProcessBuild
public static void OnPostProcessBuild(BuildTarget build, string path)
{
//Make sure this build is for iOS.
//Unity 4 uses 'iPhone' for the enum value; Unity 5 changes it to 'iOS'.
if (build.ToString() != "iPhone" && build.ToString() != "iOS")
{
UnityEngine.Debug.LogWarning("Skillz cannot be set up for a platform other than iOS.");
return;
}
if (Application.platform != RuntimePlatform.OSXEditor)
{
UnityEngine.Debug.LogError("Skillz cannot be set up for XCode automatically on a platform other than OSX.");
return;
}
//Get whether this is an append build by checking whether a custom file has already been created.
//If it is, then nothing needs to be modified.
string checkAppendFilePath = Path.Combine(path, checkAppendFileName);
FileInfo checkAppend = new FileInfo(checkAppendFilePath);
if (checkAppend.Exists)
{
return;
}
checkAppend.Create().Close();
bool trySetUp = SetUpOrientation(path) && SetUpSDKFiles(path);
if (!trySetUp)
{
//These failures aren't fatal; the developer can do them manually.
UnityEngine.Debug.LogWarning("Skillz automated steps failed!");
}
//Set up XCode project settings.
SkillzXCProjEdit editProj = SkillzXCProjEdit.LoadXCProj(path);
if (editProj == null ||
!editProj.AddLinkerFlags() || !editProj.AddSkillzFiles() || !editProj.AddRunScript() ||
!editProj.SaveChanges())
{
UnityEngine.Debug.LogError("Skillz automated XCode editing failed!");
return;
}
}