![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Unity
muyouking11
这个作者很懒,什么都没留下…
展开
-
Unity 无光照透明材质
可以用于半透明穿透物体的材质使用或者这种框选时的材质效果原创 2021-03-29 17:01:10 · 707 阅读 · 2 评论 -
Unity Lean Touch 选择物体 LeanSelect
想要在使用LeanTouch 插件时获取手指点击时所点的那个物体的信息。方法:为需要响应该Select事件的物体建立响应处理事件,比如下面这个LeanSelectableRenderColor.cs,这个是官方案例中,当小球被选中时会改变颜色的脚本。该案例为每一个小球添加了Lean Selectable组件,然后添加进对应的处理事件脚本LeanSelectableBehaviour.cs,该脚本继承自LeanSelectableBehaviour类,并且重写了里面的Awake(), OnSelect(原创 2021-03-20 16:05:02 · 688 阅读 · 0 评论 -
Unity LeanTouch 点击按下抬起事件以及LeanInfoText组件的使用
以事件的方式来控制手指的更种行为。新建一个空物体,在这个空物体上添加各种手指行为事件,点击LeanFingerTap,按下LeanFingerDown,抬起LeanFingerUp,滑动LeanFingerSwipe原创 2021-03-19 16:53:10 · 761 阅读 · 0 评论 -
Unity 想要UI文字清晰的方法
原创 2021-03-19 12:10:07 · 474 阅读 · 0 评论 -
Unity 记录 Canvas的设置
原创 2021-03-19 12:09:11 · 153 阅读 · 0 评论 -
Unity VFX使用代码控制事件
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.VFX;public class VfxEventManager : MonoBehaviour{ public VisualEffect vfx; // Start is called before the first frame update void Start() {原创 2021-02-19 16:02:17 · 1339 阅读 · 0 评论 -
Unity 鼠标控制相机移动旋转
public float rotationspeed;void FixedUpdate(){float moveH = Input.GetAxis("Mouse X");float moveV = Input. GetAxis("Mouse Y");moveH *= rotationspeed;moveV *= rotationspeed;transform. Rotate(-moveV,0,0);transform. Rotate(0,moveH,0, Space. World);}原创 2020-12-19 00:08:11 · 1782 阅读 · 1 评论 -
Unity学习笔记 3D数学
四元素公式://旋转轴Vecter3 axis = Vecter3.up;//或者:tar.position-irg.position;//旋转角度float angle = 50;//角度转弧度:float rad = Mathf.Deg2Rad(angle);Quaternion qt = new Quaternion();qt.x = Mathf.Sin(rad/2)* axis.x;qt.y = Mathf.Sin(rad/2)* axis.y;qt.z=Mathf.Sin(ra原创 2020-12-05 09:17:55 · 208 阅读 · 0 评论 -
Unity资源选择
///<summary> ///选择选中文件夹的所有材质球 ///</summary> public static List<Material> GetSelectDirectoryMat(){ //获取选择的资源路径,返回多个资源GUID string[] SlectContext = Selection.assetGUIDs; //打印第一个索引的资源路径GUID对应的string ...原创 2020-12-03 15:06:37 · 302 阅读 · 0 评论 -
Unity HDRP 遮罩和细节贴图(转自官方HDRP相关文档)
Unity HDRP 遮罩和细节贴图遮罩和细节贴图高清渲染管线 (High Definition Render Pipeline, HDRP) 使用通道打包的纹理将多个材质贴图存储在单个纹理中。通道打包具有高效率,因为这种技术允许渲染器通过单次纹理获取来采样最多四个使用相同 UV 坐标的灰度贴图。HDRP 使用两种类型的通道打包纹理:遮罩贴图 (Mask Map) 和细节贴图 (Detail Map)。这两种纹理可以使用不同的 UV 坐标集或不同的 UV 平铺值,从而为您提供更多的创作自由。本文档介绍转载 2020-11-25 09:59:22 · 3549 阅读 · 0 评论 -
Unity 技能冷却条
using UnityEngine;using UnityEngine.UI;///<summary>///技能冷却条///</summary>public class SkillItem : MonoBehaviour{ public float coldTime = 2f; private float timer = 0f; // private Image filledImage; private bool isStartTi.原创 2020-11-10 11:21:11 · 273 阅读 · 0 评论 -
Unityg开启Screen Space Reflection
原创 2020-11-07 10:52:55 · 496 阅读 · 0 评论 -
Unity 鼠标与键盘控制相机移动与旋转
using System.Collections;using System.Collections.Generic;using UnityEngine; enum MouseButtonDown { MBD_LEFT = 0, MBD_RIGHT, MBD_MIDDLE, }; public class HYQCameraController : MonoBehaviour { // [SerializeField] private Vector3 focus = V原创 2020-11-04 11:34:33 · 1284 阅读 · 0 评论 -
Unity 判断动画是否已经切换成功
private Animator anim; private AnimatorStateInfo currentState; //当前状态 private AnimatorStateInfo previousState; //记录上一个状态void Start() { anim =GetComponent<Animator>(); currentState = anim.GetCurrentAnimatorStateInfo(0); previous..原创 2020-10-29 14:06:20 · 562 阅读 · 0 评论 -
Unity Animator 切换动作时物体的位置发生变化
问题描述:播放动作1时物体站在地面位置1处,播放动作2时物体跳高了一级,并没有站在地面了,而是站在了位置2.此时选中这个动作重新back一下animation就可以了。原创 2020-10-29 12:03:37 · 1843 阅读 · 0 评论 -
UnityHDR渲染管线中使用3dsmax导入的模型丢失贴图恢复
思路:在3dsmax中先记录每一个材质球对应的材质名与其所使用的贴图名,写出文件,然后uniyt中读取这个材质名与贴图名,在unity中批量将材质球恢复贴图。3dsmax导出材质名与贴图名部分struct HMtl(mtlDiffuse,mtlReflection,mtlRefraction,mtlBump,mtlOpacity)--将list里的内容写入in_testfn formatList2 list in_text= ( file = CreatEFile in_text if lis原创 2020-10-17 17:56:27 · 1408 阅读 · 0 评论 -
Unity Attribute记录
Unity Attribute 小技巧以下Attribute控制或者影响可见性,布局,字符串,数值,提示,方法和脚本.控制可见性[HideInInspector]在Inspector属性栏里隐藏不想显示的公有字段//添加这个Attribute后就可以将下面这个字段隐藏了![HideInInspector]public bool IsAttackedByTrap = false;[SerializeField]在Inspector属性栏里显示私有字段[SerializeField原创 2020-09-26 13:07:13 · 104 阅读 · 0 评论 -
Unity 角色攻击
//=========================按下J键进行攻击====================================if (Input.GetKeyDown(KeyCode.J)){ //切换到攻击的动画 anim.SetTrigger("Launch"); //实例化一个武器 GameObject bullet = Instantiate(bulletPrefab,rbody.pos原创 2020-08-28 10:57:40 · 2492 阅读 · 0 评论 -
Unity使用射线获取某物体的信息
if(Input.GetKeyDown(KeyCode.E)){ RaycastHit2D hit = Physics2D.Raycast(rbody.position,lookDirection,2F,LayerMask.GetMask("NPC")); //NPC标签层 if (hit.collider != null){ Debug.Log("hit npc:"+hit.collider.gameObject.name);原创 2020-08-28 10:53:38 · 1411 阅读 · 0 评论 -
Unity游戏-Ruby记录截图
角色动画相关Animation如果打开的Animation界面没有这个调整帧速率的选项,就在右边的齿轮里找到打开。特效相关特效材质添加特效流程Audio Source组件模型导入选项原创 2020-08-28 10:51:39 · 162 阅读 · 0 评论 -
Unity 里使用Windows.Forms的方法记录
找到如下两个dll,System.Deployment.dll(D:\Program Files\Unity\Editor\Data\MonoBleedingEdge\lib\mono\4.5)System.Windows.Forms.dll(D:\Program Files\Unity\Editor\Data\Mono\lib\mono\2.0)然后在项目的Asset下新建一个P...原创 2018-11-10 15:53:26 · 794 阅读 · 0 评论