/Application的简单使用**///
- 打开数据所在文件夹路径
Application.dataPath+“data.txt”; - 打开持久化文件夹路径
Application.presistentDataPath; - StreemingAssets文件夹
Application.streemingAssetsPath; - 临时文件夹路径
Application.temporaryCachePath; - 打开网址
Application.OpenUrl(“www.baidu.com”); - 退出游戏
Application.Quit();
/场景管理**///
初始将所需要使用的场景添加的build中
using UnityEngine.ScenceManagement;
//索引加载
SceneManager.LoadScene(“1”); //加载的场景序号为1;
SceneManager.LoadScene(“MyScence”); //加载的场景名称为MyScene;
SceneManager.LoadScene(“MyScence”,LoadSceneMode.Single); //使用MyScene代替当前场景;
// 获取当前场景
SceneManager.GetActiveScene();
//Scene scene = SceneManager.GetActiveScene();
//查询场景内物体的数量
scene.GetRootGameObjects();
//创建新场景
SceneManager.CreateScene(“newScene”);
//卸载场景
SceneManager.UnloadSceneAsync(newScene);
//异步加载场景******/
使用协程
AsyncOperation operation;
void Start()
{
StartCoroutine(loadScene());
}
//携程方法
IEnumerator loadScene()
{
operation=SceneManager.LoadSceneAsync(1);
yeild return operation;
}
operation.progress; //场景加载进度值。
///触摸操作*
//开启多点触摸
Input.multiTouchEnable=true;
Input.touchCount;
Touch touch=Input.touchs[0];//拿到第一个触摸点
touch.position;// 触摸位置
touch.phase:
TouchPhase.Began; 触摸开始
TouchPhase.Moved; 触摸移动
TouchPhase.Stationay; 触摸保持
TouchPhase.Ended; 触摸结束
TouchPhase.Canceled; 触摸取消
/*Lambda表达式///
匿名委托
Func
{
return a+b;
}
------------------->
Func
Func
/****LINQ//



