【Unity开发】Unity3d学习笔记记录

来源:互联网 发布:淘宝童装平铺拍照技巧 编辑:程序博客网 时间:2024/05/18 14:23

1.发布到 ipad字体显示不出来,改变Position位置的Z轴为-1

2.发布打包有问题,记得用户权限有没有设置

3.ipad4分辨率:2048*1536

4.调整界面大小,尽量调整底下子对象位置

5.Anchor->offset->(锚定位置,让位置固定)

6.加载fbx模型不能太大,ipad运行不了,塌陷下就可以用

7.reset panning  复位平移

8.在prefab上右击导出package,会自动关联到所有该prefab调用的资源并导出。如果导出场景,就在场景文件上右击导出,场景内的所有资源关联都不应该丢失。

9.物体重新设置位置,相对坐标(记得移除位置编译脚本)

btn1.transform.localPosition = newVector3(200,-224,0);

11.遍历获取子对象

GameObject go = GameObject.Find("Offset");

foreach(Transform child in go.transform)

{

child.gameObject.SetActive(false);

}

12.给游戏对象GameObject赋值图片

m_PlaneSlider.renderer.material.mainTexture = Texture

动态加载:m_Panel.renderer.material.mainTexture = (Texture2D)Resources.Load(ShowImgName);


13.ipad上调试unity程序,通过写入信息到文本来调试(Application.persistentDataPath位置为/var/mobile/Application/xxxxxx/Document)

public static void CreateFile(string path,string name,string info)   {    StreamWriter sw;   FileInfo t = new FileInfo(path+"//"+ name);   if(!t.Exists)   {    sw = t.CreateText();}else{sw = t.AppendText();}sw.WriteLine(info);sw.Close();sw.Dispose();   }  public staticvoid DeleteFile(string path,string name){File.Delete(path+"//"+ name);}

14.Unity用Input.GetKeyDown()获取按键是否按下,相反可以用Input.GetKeyUp()获取按键是否抬起,长按判断用Input.GetKey()

()里面参数格式:Key.Code.A

Input.GetMouseButtonDown()来判断鼠标是否按下,()里面只有一个参数,0代表鼠标左键,1右键,2中键

Input.GetMouseButtonUp()  抬起

Input.GetMouseButton() 长按


15.


原创粉丝点击