Unity_技巧
阿普左轮
这个作者很懒,什么都没留下…
展开
-
Raycast用layermask获取子物体的transform
unity, rayhit原创 2022-02-22 12:06:17 · 3069 阅读 · 0 评论 -
The system is running out of memory. Please close applications to free memory
The system is running out of memory. Please close applications to free memory or free up space on the partition where the pagefile is located.重启电脑解决原创 2021-11-26 13:50:08 · 1575 阅读 · 0 评论 -
Unity显示帧率代码
新建一个FPSDisplay的脚本,把下面的代码粘贴进去,或者这里下载。然后把脚本挂载场景中任意物体上。using UnityEngine;using System.Collections; public class FPSDisplay : MonoBehaviour{ float deltaTime = 0.0f; void Update() { deltaTime += (Time.unscaledDeltaTime - deltaTime) * 0.1f; } voi原创 2021-08-13 14:58:39 · 894 阅读 · 0 评论 -
Unity平滑着色方法
点击需要平滑着色的模型,将Normal选为Caculate.然后调整Smoothing Angle。度数越大表面越光滑。这样我们就可以将一些lowpoly风格的模型调整的更好看。原创 2021-08-04 17:33:39 · 1152 阅读 · 0 评论 -
Unity里如何让物体的轴对准某一个物体(方向)
实现方法很简单,直接对物体的transform设置即可。我们可以看到:模型的z轴(蓝色)对应正方向:transform.up模型的y轴(蓝色)对应上方向:transform.forward模型的x轴(红色)对应右方向:transform.right如果我们想让模型的头顶对准白色方块 public Transform target; void Update() { transform.up = target.position-transform.posi原创 2021-08-11 08:24:40 · 4760 阅读 · 2 评论 -
Unity创建渐变背景
介绍:开发小游戏的时候,对于场景的要求并不是很大,但如果一种颜色又显得过于单调。这时我们就可以用渐变背景。例如:教程:1.首先我们把摄像机的Clear Flags设置为Solid Color,然后把background的颜色调成自己喜欢的颜色。如果是URP,在摄像机的Environment里设置。2.将图片(最下面链接)的Texture Type设置为Sprite,然后拖入场景中。会自动生成一个Sprite Renderer的组件3.调整组件的位置,旋转角度、大...原创 2021-08-06 19:13:44 · 1474 阅读 · 0 评论