我的Unity冷知识记录

  • UGUI图片沿X或Y翻转180°后会失去射线检测效果[2018.1]
 原因: Canvas的GraphicRaycaster的`Ignore Reversed Graphics`选项决定反转的Graphic是否会被射线检测忽略
  • Mask组件的Show Mask Graphic属性在Animation动画中改变后无效 [2018.2]
可能是bug
  • Editor中RectTransform的锚点消失[2018.2].
Bug: 重启Editor没用,需要关闭Scene标签后重新打开.或者试试在[Window]—>[Layouts]中重新应用窗口布局
  • Animator.Rebind()
在animator组件disable之前调用它,回滚动画到动画开始的状态.
Description 描述
Rebind all the animated properties and mesh data with the Animator.

重新绑定动画器的所有动画的属性和网格数据。

This function can be used when you manually change your GameObject hierarchy by script, like combining meshes or swap a complete transform hierarchy.

这个函数用于当你手动通过脚本修改对象的层级时使用,像合并网格或交换一个完整的变换层级。
  • Animator is not playing an AnimatorController.
如果gameobject的activeSelf=false,当你播放animator时,会得到此警告并且,设置参数是无效的.
  • Selectable 是先调用前一个的OnDeselect,然后再将Event System的SelectObject设为此物体,调用此物体OnSelect
 // Event System
   public void SetSelectedGameObject(GameObject selected, BaseEventData pointer)
    {
      if (this.m_SelectionGuard)
      {
        Debug.LogError((object) ("Attempting to select " + (object) selected + "while already selecting an object."));
      }
      else
      {
        this.m_SelectionGuard = true;
        if ((UnityEngine.Object) selected == (UnityEngine.Object) this.m_CurrentSelected)
        {
          this.m_SelectionGuard = false;
        }
        else
        {
          ExecuteEvents.Execute<IDeselectHandler>(this.m_CurrentSelected, pointer, ExecuteEvents.deselectHandler);
          this.m_CurrentSelected = selected;
          ExecuteEvents.Execute<ISelectHandler>(this.m_CurrentSelected, pointer, ExecuteEvents.selectHandler);
          this.m_SelectionGuard = false;
        }
      }
    }
  • 在Scence视图中选中Object之后,层级视图中被选中的物体没有被高亮[?].
可能是层级视图标签激活了Lock:右键点击层级视图,去掉Lock的勾选.
  • Ps中F8查看选中图层的大小,做UI动画的时候很方便.
  • Android studio 默认SDK路径C:\Users\adminxxx\AppData\Local\Android\Sdk
  • 脚本在Inspector中没有勾选框?

    MonoBehaviour is the base class from which every Unity script derives.
    When you use C#, you must explicitly derive from MonoBehaviour.
    This class doesn't support the null-conditional operator (?.) and the null-coalescing operator (??).
    Note: There is a checkbox for disabling MonoBehaviour on the Unity Editor. It disables functions when unticked. If none of these functions are present in the script, the Editor does not display the checkbox. The functions are:
    Start()
    Update()
    FixedUpdate()
    LateUpdate()
    OnGUI()
    OnDisable()
    OnEnable()

  • Awake()和Start()的区别?(很有用,但容易被忽略)
    Generally the main difference is:
    Awake: Here you setup the component you are on right now (the "this" object)
    Start: Here you setup things that depend on other components.
    if you split it that way you can always be sure that the other object is ready to work with you as game objects in scenes on scene load are loaded in blocks:
    1. All awake are executed
    2. All start are executed
    3. all go into update
  • OnApplicationPause(bool)与Application.IsPlaying( Unity执行顺序OnApplicationPausse)
    OnAppllicationPause被调用是在Pause指令发生后的一帧,但是在实际暂停的前一帧.Applcation.IsPlaying只在Editor中有用,在游戏端永远是True.
    Note:在Android上,当启用屏幕键盘时,它会导致OnApplicationFocus(false)事件。此外,如果在启用键盘时按“Home”,则不会调用OnApplicationFocus()事件,而是调用OnApplicationPause().
    Note:OnApplicationPause可以被协程.
  • 插件
- Mesh Baker    烘培
- NSpeex        语音
- PoolManager   对象池

快捷键相关
  • 动画窗口热键
    • K - Key all animated. Adds an keyframe for all animated properties at the current position of the playback head in the animation window.
    • Shift-K - Key all modified. Adds an keyframe for only those animated properties which have been modified at the current position of the playback head in the animation window.
    • R - Ripple editing(波纹编辑).Press and hold the R key while dragging inside the Box Selection to perform a Ripple Move.Press and hold the R key while dragging a Box Selection handle to perform a Ripple Scale.
  • UnityEDior在调试时报错:Fatal error in gc: GetThreadContext failed”,有可能是杀毒或360软件引起的,关闭这些软件
  • 如果在Dotween的OnComplete()中调用DoRewind(),那么这个Tween的将不会完成,如果在协程中Yield Tween.WaitForCompletion(),则永远不会走到下一步!!

转载于:https://www.cnblogs.com/Fallever/p/9427683.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值