当前位置:网站首页>【100个 Unity踩坑小知识点】| 在编辑器中绘制正方体虚线、球体虚线(Gizmos 辅助线框)
【100个 Unity踩坑小知识点】| 在编辑器中绘制正方体虚线、球体虚线(Gizmos 辅助线框)
2022-06-21 10:59:00 【华为云】

Unity 小科普
老规矩,先介绍一下Unity的科普小知识:
- Unity是 实时3D互动内容创作和运营平台 。
- 包括游戏开发、美术、建筑、汽车设计、影视在内的所有创作者,借助Unity将创意变成现实。
- Unity 平台提供一整套完善的软件解决方案,可用于创作、运营和变现任何实时互动的2D和3D内容,支持平台包括手机、平板电脑、PC、游戏主机、增强现实和虚拟现实设备。
- 也可以简单把 Unity 理解为一个游戏引擎,可以用来专业制作游戏!
Unity 踩坑小知识点学习
在编辑器中绘制正方体虚线、球体虚线(Gizmos 辅助线框)
使用Gizmos类可以让我们在Unity中实现一种辅助线框,下面举例几种常用的线框。
更多的API可以来 官方手册关于Gizmos查看
使用Gizmos绘制线框要在下面两个函数中使用:
private void OnDrawGizmos(){ Debug.Log("持续调用" );}private void OnDrawGizmosSelected(){ Debug.Log("selected,只有物体选中后调用" );}还可以使用Gizmos.color改变颜色。
注意:正常情况下只能在Scene中看到线框,在Game视图中要开启Gizmos才可以看到线框
正方体和球体虚线框如下:
private void OnDrawGizmos() { Gizmos.color = Color.green;//改变线框的颜色 Gizmos.DrawWireCube(transform.position, new Vector3(3, 3, 3));//正方体虚线框 Gizmos.DrawWireSphere(transform.position, 5f);//球体虚线框 }正方体和球体线框如下:
private void OnDrawGizmos() { Gizmos.color = Color.green;//改变线框的颜色 Gizmos.DrawCube(transform.position, new Vector3(3, 3, 3));//正方体线框 Gizmos.DrawSphere(transform.position, 5f);//球体线框 }
边栏推荐
- Actual measurement: the performance of cloud RDS MySQL is 1.6 times that of self built
- 开源FTP 服务器 FileZilla Server
- Revenue of Fortinet will increase by 29% in 2021 founder Xieqing talks about the future of network security industry
- Dapr advanced -02- view dapr logs
- Record an SVN error assertion `svn_ uri_ is_ canonical(child_uri, NULL)‘ failed.
- 无界版图荣获2022年度数字文化产业创新品牌称号
- Mqtt of NLog custom target
- The delimiter connects the list string without secondary processing joiner on(). join()&&String. join(“,“, list)
- Kotlin - I/O流
- Messageformat usage
猜你喜欢

The most powerful eight part essay in 2022, "code out eight part essay - cut out the offer line"

One of the components of the program

功能测试怎么学?阿里工程师教4个步骤

Swift 之返回按钮

转赠券发放倒计时!星际口袋转赠规则抢先看

一款完整开源的物联网基础平台

CAS central certification service

Simple implementation of Snake game in C language

IAAs, SaaS, PAAS, DAAS concepts

One line of code accelerates sklearn operations thousands of times
随机推荐
Concept of naive Bayes
support vector machine
Citus 11 for Postgres 完全开源,可从任何节点查询(Citus 官方博客)
Wangedit encapsulation plug-in preliminary
Starting a prairie fire, Alibaba cloud database "hundred cities gather together" to help small and medium-sized enterprises' digital intelligence transformation
用map集合或者list集合存放list集合
C# Cannot access child value on Newtonsoft.Json.Linq.JProperty
Use the spatial complexity of O (1) to flip the linked list
TS - Enumeration
Es composite query workload evaluation
失控玩家
The out of the box caching function of angular server-side rendering applications
Map集合遍历,添加替换,删除元素
boost一定要入门呀
03. Redis actual battle: meeting goddess nearby by geo type
WPF DataContext usage
06. Redis log: the trump card for fast recovery without fear of downtime
Iptables Foundation
Do you understand the capacity expansion mechanism of ArrayList?
Unable to access gcr IO solutions