zoukankan      html  css  js  c++  java
  • unity inspector 自动装载Commont和Prefab属性

    在使用unity的过程中,经常遇到这样的问题:每次都需要手动为序列化属性拖拽赋值。像这样:

    试着找了找,真的找到了一份代码,但是缺少自动装载Prefab的功能。之后我花了点时间添加这个功能。

    使用方法:

     1   [Autohook]
     2     public Button SendBtn;
     3     [Autohook]
     4     public Button StartBtn;
     5     [Autohook]
     6     public Button LeaveBtn;
     7     [Autohook]
     8     public Text RoomDateText;
     9     [Autohook]
    10     public ScrollRect PlayerList;
    11 
    12     [Autohook]
    13     public GameObject PlayerBarPrefab;
    14     [Autohook]
    15     public GameObject RoomBarPrefab;

    Autohook会自动在子节点中寻找对应的名称。

    如果要自动赋值Prefab,类型必须为GameObject,并且有Prefab后缀。

    例如: [Autohook] public GameObject RoomBarPrefab; 

    这一句会在Prefabs的目录下寻找RoomBar这个prefab,并赋值到此。

    代码包:

    链接: https://pan.baidu.com/s/1ITUicf2pbt9EoqWhgoCojg 提取码: hwvs

  • 相关阅读:
    排序算法——选择排序
    poj1906
    poj1496
    poj1244
    poj1183
    poj1806
    !!!舒尔茨自律神经训练法
    Google Analytics的能与不能
    乔布斯最伟大的贡献是什么
    冥想呼吸
  • 原文地址:https://www.cnblogs.com/backinfile/p/12359861.html
Copyright © 2011-2022 走看看