1.崩溃和报错
Application.logMessageReceived += unityLogHander;
private unityLogHander(string log_, string stackInfo_, LogType type_){
if (
type_ == LogType.Assert ||
type_ == LogType.Error ||
type_ == LogType.Exception
){
//Editor + Debug 下弹出提示框
//非 Editor + Debug 下报bugly
}
}
2.运行时,跨环境调用
2 - 1 - IOS 交互
2 - 2 - Android 交互
2 - 3 - lua 交互
3.AssetsBundle相关
using UnityEditor;
using UnityEngine;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
/*
工程目录 的 Assets 目录
Application.dataPath
AB包构建需要的一些文件操作,详细操作方式查阅以下类的文档。
File、FileInfo、Directory、DirectoryInfo
平台判断
EditorUserBuildSettings.activeBuildTarget == BuildTarget.Android
EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS
*/
//获取工程相某个文件夹下的文件列表的相对路径
public static List<string> getRelativeFilePathList( string relativeFolder_ , List<string> filterList_ = null ){
string _targetRelativeFolderPath = System.IO.Path.Combine( Application.dataPath , relativeFolder_ );
List<string> _fileRelativePathList = new List<string>();
DirectoryInfo _targetDirInfo = new DirectoryInfo( _targetRelativeFolderPath );//文件夹信息
for (int _idx = 0; _idx < filterList_.Count; _idx++) {
FileInfo[] _targetFileInfos = _targetDirInfo.GetFiles( filterList_[_idx] , SearchOption.AllDirectories );//满足后缀的文件信息列表
for (int _j = 0; _j < _targetFileInfos.Length; _j++) {
string _filePath = _targetFileInfos[ _j ].FullName;//绝对路径
string _relativePath = _filePath.Substring( _filePath.IndexOf("Assets") );//相对路径
_fileRelativePathList.Add(_relativePath);
}
}
return _fileRelativePathList;
}
//获取其所依赖的文件列表
public static string[] getDependencies