在使用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

unity inspector 自动装载Commont和Prefab属性的更多相关文章

  1. C#开发Unity游戏教程之游戏对象的属性变量

    C#开发Unity游戏教程之游戏对象的属性变量 Unity游戏对象的属性——变量 通过对上一章的学习,读者应该了解到了,游戏对象上的属性与脚本中的变量,建立联系的方式就是将脚本赋予游戏对象.上一章只是 ...

  2. php类自动装载、链式操作、魔术方法

    1.自动装载实例 目录下有3个文件:index.php load.php tests文件夹 tests文件夹里有 test1.php <?php namespace Tests; class T ...

  3. spring Bean类自动装载实现

    先贴spring的开发文档,有助于大家学习http://shouce.jb51.net/spring/beans.html#beans-factory-class 一直想研究一下spring bean ...

  4. Spring核心技术(八)——Spring自动装载的注解

    本文针对自动装载的一些注解进行描述. 基于注解的容器配置 @Required注解 @Required注解需要应用到Bean的属性的setter方法上面,如下面的例子: public class Sim ...

  5. Spring深入浅出(二)IOC的单例 ,继承,依赖,JDBC,工厂模式以及自动装载

    IOC的单例模式--Bean Spring中的bean是根据scope来决定的. scope有4种类型: 1.singleton:单例模型,表示通过Spring容器获取的该对象是唯一的.常用并且默认. ...

  6. Vue基于webpack自动装载配置

    Vue的自动装载配置是在 @cli/cli-service 包中,配置文件的目录在 lib/config/  下的文件,css.js 文件是配置样式的处理,先从这里开始了解把 CSS配置流程 对应着这 ...

  7. 【js】将table的每个td的内容自动赋值给其title属性

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  8. Archlinux 的U盘自动装载(三)udevil

    U盘的自动装载方法,目前我已经使用过以下几种方法: udev 规则 基于 udev 规则的 Shell script udisks 以及 udisks2 结果,总是存在这样那样的小问题.例如,文件名乱 ...

  9. Archlinux 的U盘自动装载(一)udisks

    为什么要用 udisks + udevil 方式自动装载 U 盘? Gnome 和 KDE 下的很多文件管理器都有自己的U盘装载方案.但我的应用环境为: Archlinux,xorg,Openbox, ...

随机推荐

  1. activiti app 6.0 乱码

    登录activiti-admin 乱码,解决后如下: 在catalina.bat文件中设置 -Dfile.encoding=UTF-8 1,windows 修改catalina.bat tomcat7 ...

  2. .net core 返回业务错误(不抛异常)

    在开始之前你需要知道: 1.通过抛异常--全局捕获异常的方式返回业务错误信息性能是非常差的(不知道为什么的可以百度一下) 2.如何将错误信息绑定到mvc模型验证中 自定义返回内容 //返回内容接口 p ...

  3. 表格取消全选框,用文字表示--Echarts ElementUi

    1.先看看实现的图 一. 添加添加复选框列 <el-table v-loading="zongShipLoading" tooltip-effect="dark&q ...

  4. Forward Rendering VS Deferred Rendering

    http://gad.qq.com/article/detail/32731 Forward Rendering Deferred Rendering

  5. 01vue.config.js

      const path = require('path'); module.exports = { // 基本路径 publicPath: process.env.NODE_ENV === 'pro ...

  6. 小程序开发-使用npm包

    微信小程序引用npm包 微信小程序官方支持使用npm包,地址为 https://developers.weixin.qq.com/miniprogram/dev/devtools/npm.html 实 ...

  7. padding-top:100%解决高度塌陷问题

    <div class="img_box"> <img src="http://sms-shop.oss-cnbeijing.aliyuncs.com/$ ...

  8. C010:书号分解ISBN

    代码: #include "stdafx.h" int _tmain(int argc, _TCHAR* argv[]) { int prefix,groupIndentifier ...

  9. 给MySQL中数据表添加字段

    添加一个char字段: mysql> alter table stock add src char(20); Query OK, 3766 rows affected (0.65 sec) Re ...

  10. pwnable——flag

    分析 此题为reverse题目,首先放入ida查看: 程序函数太少,应该加过壳 在hex view中发现程序通过upx加壳,利用upx -d 指令解压得到程序,重新放入ida查看 程序非常简单,读取f ...