位置: 编程技术 - 正文
推荐整理分享CustomPropertyDrawer-Change the height of Property field,希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!
The last blog post didn't cover a certain nifty method in PropertyDrawer, which is the GetPropertyHeight.
GetPropertyHeight: Determines the height in pixel of the property field.
Overriding GetPropertyHeight therefore allows you to determine the height of your property field, instead of using the default property height.
The following examples shows how you can use GetPropertyHeight. I'll be using the WeaponType enum to determine weapon type on a character as an example. Every example will add/modify the behaviour of the Example 1.
Example 1:
This example shows our base for drawing an enum popup. This is also the default Unity behaviour.
Example 2:
Next we adjust the height of our property field, such that we can add a catch phrase to our weapon type.
Example 3:
Lastly, we modify the height given WeaponType such that only Bazooka has a catch phrase.
When to use?
The first usage is when you need more space for your property drawer, which can be due to having a lot of fields that needs to be drawn.
The second reason could be because an object has different states. E.g. if we had the following Weapon class:
Splash radius might only be usable when having a bazooka, where as agun wouldn't need the splash damage field. We could then hide splash damage, when we have the type: Gun. This would also help the designers, since you could hide "useless" fields in certain states.
原文地址:
复习之增删改查 欢迎来到unity学习、unity培训、unity企业培训教育专区,这里有很多U3D资源、U3D培训视频U3D教程、U3D常见问题、U3D项目源码,我们致力于打造业内unity3d培
飞机大战之GUI设置 unity学习,希望我的博客能给喜欢unity的朋友带来帮助前几天我们讲了飞机大战,但是界面设置却不完整,缺少文字提示等内容,接下来我们就用GUI来实
数据库多表连接 我今天学习了数据库的多表连j接,分别有内连接和左外连接还有右外连接,这三个连接是最基本的连接。1.内连接分为是三种:等连接是指表之间通过等
标签: CustomPropertyDrawer-Change the height of Property field
本文链接地址:https://www.jiuchutong.com/biancheng/377325.html 转载请保留说明!上一篇:Unity光照烘焙后,在PC上曝光,发布移动平台正常的解决方法(unity灯光烘培)
下一篇:复习之增删改查(增删改查的语句)
友情链接: 武汉网站建设