1.关于dll库的问题!!!!!!!!!!!!
在编写一个关于生成xml文件的脚本时引用了
using System.IO;
using System.Xml;
但是并没有引用using System.Windows.Forms;
使用了_xmlpath = Application.dataPath + "/user.xml";
XmlDocument xmlDoc = new XmlDocument();//xin jian xml shi li XmlElement root = xmlDoc.CreateElement("Root");//gen jie dian , zui shang ceng jie dian xmlDoc.AppendChild(root);//zhi jie dian XmlElement user = xmlDoc.CreateElement("User");//yong hu jie dian
编译运行没错!!!!!最后发布时,报错无法找到 System.Windows.Forms.dll,,,,解决方案是找到PlayerSetting Api Compatibility Level 设置为.net 2.0。。。并且发现在Assets下的Plugins文件夹里是有一个System.Windows.Forms.dll的。
5.MonoBehaviour基类和类的继承和接口的继承。接口一般都是I开头。
using UnityEngine.EventSystems; public class point_event : MonoBehaviour,IPointerEnterHandler, IPointerExitHandler, IPointerDownHandler, IPointerUpHandler { public Text text1; public void OnPointerEnter(PointerEventData eventData) { text1.text = "OnPointerEnter"; } public void OnPointerExit(PointerEventData eventData) { text1.text = "OnPointerExit"; } public void OnPointerDown(PointerEventData eventData) { text1.text = "OnPointerDown"; } public void OnPointerUp(PointerEventData eventData) { text1.text = "OnPointerUp"; }
2.动态窗口,四元数,使窗口能跟随鼠标发生角度变化
public class dynamic_window : MonoBehaviour { public Vector2 range = new Vector2(-7f, -5f);//rangge 在面板上参数为-7,-5 Transform mTrans; Quaternion mStart; Vector2 mRot = Vector2.zero; // Use this for initialization void Start () { mTrans = transform; mStart = mTrans.localRotation; } // Update is called once per frame void Update () { Vector3 pos = Input.mousePosition; float halfWidth = Screen.width * 0.5f; float halfHeight = Screen.height * 0.5f; float x = Mathf.Clamp((pos.x - halfWidth) / halfWidth, -1f, 1f); float y = Mathf.Clamp((pos.y - halfHeight) / halfHeight, -1f, 1f); mRot = Vector2.Lerp(mRot, new Vector2(x, y), Time.deltaTime * 5f); mTrans.localRotation = mStart * Quaternion.Euler(-mRot.y * range.y, mRot.x * range.x, 0f); }