1 打包过程中,log有错误,运行exe,提示XXX_Data fold not found
原因:可能添加了更高版本的dll
解决:从Unity安装文件夹下的lib/mono/2.0里复制使用
同时,player 设置里选择.net2.0.。
2. Invoke 和InvokeRepeating
代码如下,注意 如果将target设置添加了该脚本的对象,则实例处理的对象也包含InvokeScript脚本,会再次执行SpawnObject。
invoke只执行一次;
invokerepeating 重复执行。
------------------------------------------------------------------------------------------------
public class InvokeScript : MonoBehaviour {
public GameObject target;
// Use this for initialization
void Start () {
//Invoke ("SpawnObject", 2);
InvokeRepeating ("SpawnObject", 2, 1);
}
// Update is called once per frame
void Update () {
//Debug.Log (Time.time);
}
void SpawnObject(){
Instantiate (target, new Vector3 (0, 2, 0), Quaternion.identity);
}
}
----------------------------------------------------------------------------------------------------