周笔记(20/52) - 在学Unity……

于是乎这一篇编程Unity学习过程中的小知识点集锦了~

问题列表

UI

  1. 如何使用Material?RichText的quad图片根据material指定的吗?
  2. Position as UV1有什么用?看上去貌似是用来写shader的?
    (It passes the canvas position through to the first UV channel. This can be used for things like refraction or UV offset sampling in a custom shader.)

笔记

UI

  1. RectTransform:在每帧结束、计算UI Vertices前计算改变。第一次Start和Update时未经计算。可使用Canvas.ForceUpdateCanvases()来强行刷新。
  2. Canvas:
    1. Aspect ratio filter:Width Controll Height
  3. Animator:改变例如Button的Translation
  4. Auto Layout(适配):
    1. 改变:driven properties、LayoutRebuilder.MarkLayoutForRebuild
    2. 不要再在inspector里重设被驱动的数值
    3. 继承 ILayoutElement/ILayoutGroup/ILayoutSelfController 以自定义
    4. 先考虑width后考虑height:从子到父计算大小 -> 从父到子设置大小
  5. RichText
    1. Debug.Log里也可以用RichText来更炫酷的打印
    2. 用material来指定材质列表里的材质
    3. 用quad在行内插入图片

Camera

  1. 第二摄像机:
    1. GetComponent().pixelRect = new Rect(hloc,vloc,hsize,vsize);
  2. 切换摄像机:
    1. GetComponen().enabled = cameraActive;
    2. GetComponent().enabled = cameraActive;
  3. 截屏:
    1. photoGUI.SetActive (false);
    2. Texture2D texture = new Texture2D(textWidth,textHeight);
    3. yield return new WaitForEndOfFrame();
    4. texture.ReadPixels(IRect)framing, 0, 0);
    5. texture.Apply();
    6. photoGUI.SetActive (true);
  4. 保存图片
    1. Texture2D.EncodeToPNG

Shader

(换用xmind记这一块。。)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值