Unity2018.4送的Prefab Variant(Prefab变种)功能了解一下

Unity 2018.4中送了一个新的功能: Prefab Variant

思路是, Prefab Variant 继承于一个父Prefab, 父Prefab属性修改后:

(1)如果子Prefab的某些属性不动, 则父Prefab的属性影响子Prefab的属性, 此为 [属性继承]

(2)如果对子Prefab的某些属性进行修改/覆盖, 则父Prefab的属性无法影响, 此为 [属性定制]

创建Prefab Variant的方法为: 把Prefab从Hierarchy再次拉到Project中,选择 Prefab Variant

用处举例:

比如做一个UGUI窗体模板, 上面有标题文字和关闭按钮

邮件窗体继承于此窗体模板,制作成为一个PrefabVariant, 但是标题文字定制修改为"邮件"

这时,可以通过修改窗体模板中的关闭按钮,对所有派生的窗体按钮进行修改

 附:以下为官方对PrefabAssetType的解释:

    public enum PrefabAssetType
    {
 
        //
        // 摘要:
        //     The object being queried is not part of a Prefab at all.
        NotAPrefab = 0, // 不是Prefab
 
        //
        // 摘要:
        //     The object being queried is part of a regular Prefab.
        Regular = 1, // 常规的Prefab
 
        //
        // 摘要:
        //     The object being queried is part of a Model Prefab.
        Model = 2, // 模型(例如:FBX)
 
        //
        // 摘要:
        // The object being queried is part of a Prefab Variant.
        // A Variant Prefab is a Prefab that is derived from another Prefab, 
        // that be could be a Regular, Model or even Variant Prefab.
        Variant = 3, // Prefab变种
 
        //
        // 摘要:
        //     The object being queried is part of a Prefab instance, but because the asset
        //     it missing the actual type of Prefab can’t be determined.
        MissingAsset = 4 // Prefab实例化出来的对象,但是Prefab被删了(红色)
    }

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值