Resources.Load();必须放在Resources目录下才有效
GameObject root = new GameObject (rootName);
//生成Prefab 添加一张预览用的SpriteGameObject go = new GameObject(goName);
go.transform.SetParent (root.transform);
EditorCurveBinding pos_x_curveBinding = new EditorCurveBinding();
pos_x_curveBinding.type = typeof(Transform);
pos_x_curveBinding.path = "";
pos_x_curveBinding.propertyName = "m_LocalPosition.x";
PrefabUtility.CreatePrefab(directoryName + "/" + rootName + ".prefab", root);
DestroyImmediate(root);
场景切换
using UnityEngine.SceneManagement;
buttonStart.onClick.AddListener (returnMainScene);
private void returnMainScene(){
Debug.Log ("切换到主场景");
SceneManager.LoadScene (1);
}
摄像机类型 projection
透视(perspective)远大近小
正交(orthographic) 实际比例,没有透视变形