zoukankan      html  css  js  c++  java
  • unity-疑难杂症(一)

    1、使用odin插件序列化,当出现预制体有引用类型的关联, 拖到scene就没关联时,可右键预制体--Reimport解决。

    2、类似问题1,脚本组件关联AudioMixer,拖到scene没有关联,右键Reimport之后才正常。

    3、注意:当本身拖预制体到scene里边,然后进行脚本Reimport,是不能成功的。

    4、lua层调用的C#函数里: 如果audioMixer.?SetFloat("",1) 的audioMixter为null的话会报错。 和C#调用不一样。 注意!

    5、但transform的position过大比如9999时,精度丢失问题严重,再打unity编辑器将会显示警告精度问题、提示缩小坐标空间

    6、【重要】测试发现不同的GameObject之间并不总是,全部执行了OnDisable之后才执行OnDestroy。(怀疑人生..)

    7、UI的Transform.InverseTransformPoint ,其中的WorldPosition 对应的是屏幕的position(对标mouseposition) 。

    1)RectTransform继承自Transform,所以RectTransform.InverseTransformPoint等同。

    2)RectTransform.rect.position含义:锚点在rect的像素位置。

    8、安卓环境,需要jdk、sdk。 而当需要使用第三方C/C++库时,需要ndk。

    9、Renderer组件里的材质球(materials)列表只能整个列表赋值,而不能单个索引单个赋值,不生效也不报错。

    10、Unity2019使用Odin,非基础类型的List需要手动AOT,否则pc、手机包序列化失败。

     11、技能编辑器 static字段 EditorGUIUtility.Load() , --- unity load is not allowed to be called from a scriptableobject constructor

     12、同一个时间片里,EditorApplication.isPlaying= true且new GameObect的会在停止后残留。 【处理】在OnGUI函数new GameObject

    --[UI]--

    1、继承Unity的类的时候需要注意OnEnable、OnDisable基类函数的重写。如果不调用base.XX有可能有问题。 比如RawImage,不添加base.OnEnable的时候会有 enabled切换的异常。底层就不执行OnEnable了

     1 public class Test : MonoBehaviour
     2 {
     3     private GameObject notDestroyGO;
     4     void Start()
     5     {
     6         notDestroyGO = FindObjectOfType<Test1>().gameObject;
     7         Debug.LogError(" not "+ notDestroyGO);
     8     }
     9     void OnDisable()
    10     {
    11         Debug.LogError("notDestroyGO.transform.position " + notDestroyGO.transform.position);
    12     }
    13 }
    14 
    15 public class Test1 : MonoBehaviour
    16 {
    17     void OnDestroy()
    18     {
    19         Debug.LogError("Test1 -OnDestroy-");
    20     }
    21 }
    验证例子
  • 相关阅读:
    Static Linking versus Dynamic Linking
    C keywords are overloaded with serveral meanings
    深圳立体地图查查吧http://sz.chachaba.com/api.html
    What's a Declaration? What's a Definition?
    jQuery Template and Data Linking
    XPath
    singleton及多线程验证,所有线程完成才继续运行WaitHandle
    jquery文本框只输入数字插件
    UVA 993 Product of digits
    HDU 1879 继续畅通工程
  • 原文地址:https://www.cnblogs.com/Jaysonhome/p/12192754.html
Copyright © 2011-2022 走看看