当前位置: 首页 > 编程日记 > 正文

Unity脚本生成插件:Script Create Dialog

最近写代码又犯懒了...
感觉每次新建脚本都要写一堆简单重复的东西好无聊,所以搜索了一下有没有自动生成脚本的插件。结果还真被我发现了,官方在N久之前就制作了自动生成脚本的插件[Script Create Dialog],大概是名字起的和脚本生成器相差太多,现在的开发工具又太强大,所以被埋没了。所支持的Unity版本 3.4.2及以上,远古时期遗留的资源。试用了一下,感觉要是刚学Unity脚本的时候有这个插件,能省下很多读API的时间。

插件效果

插件UI

使用方式

1.下载我修改后的插件
链接:https://pan.baidu.com/s/1oa8r... 密码:6zln

2.下载官方插件并修复脚本错误
官方下载地址:https://assetstore.unity.com/...

如果导入插件后出现以下错误:
错误提示
Assets/CreateScriptDialog/Editor/NewScriptWindow.cs(454,47): error CS0117: UnityEditorInternal.InternalEditorUtility' does not contain a definition for AddScriptComponentUnchecked'

把错误部分代码改为:

if (CanAddComponent()) {// Need to use reflection to access this now (it is internal)MethodInfo addScriptMethod = typeof(InternalEditorUtility).GetMethod("AddScriptComponentUncheckedUndoable",BindingFlags.Static | BindingFlags.NonPublic);addScriptMethod.Invoke(null, new Object[] {m_GameObjectToAddTo,AssetDatabase.LoadAssetAtPath(TargetPath(), typeof (MonoScript)) as MonoScript});
}

3.右键使用
Assets窗口下右键>Create>Script...打开窗口使用。
右键打开窗口

UI窗口

4.可以自定义新的脚本模板
使用说明在ReadMe.html中可以看到。
方法模板在MonoBehaviour.functions.txt中可以看到。可以根据规则添加自定义模板。

BASECLASS=MonoBehaviour
using UnityEngine;
using System.Collections;
using System.Collections.Generic;public class $ClassName : MonoBehaviour {$Functions
}
void Awake() Awake is called when the script instance is being loaded.
DEFAULT void Start() Start is called just before any of the Update methods is called the first time.
DEFAULT void Update() Update is called every frame, if the MonoBehaviour is enabled.
void LateUpdate() LateUpdate is called every frame, if the Behaviour is enabled.
void FixedUpdate() This function is called every fixed framerate frame, if the MonoBehaviour is enabled.
void OnGUI() OnGUI is called for rendering and handling GUI events.
void OnEnable() This function is called when the object becomes enabled and active.
void OnDisable() This function is called when the behaviour becomes disabled () or inactive.
void OnDestroy() This function is called when the MonoBehaviour will be destroyed.
void Reset() Reset to default values.
HEADER Physics
void OnTriggerEnter(Collider other) OnTriggerEnter is called when the Collider other enters the trigger.
void OnTriggerExit(Collider other) OnTriggerExit is called when the Collider other has stopped touching the trigger.
void OnTriggerStay(Collider other) OnTriggerStay is called once per frame for every Collider other that is touching the trigger.
void OnCollisionEnter(Collision collision) OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.
void OnCollisionExit(Collision collisionInfo) OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.
void OnCollisionStay(Collision collisionInfo) OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider.
void OnControllerColliderHit(ControllerColliderHit hit) OnControllerColliderHit is called when the controller hits a collider while performing a Move.
void OnJointBreak(float breakForce) Called when a joint attached to the same game object broke.
void OnParticleCollision(GameObject other) OnParticleCollision is called when a particle hits a collider.
HEADER Mouse
void OnMouseEnter() OnMouseEnter is called when the mouse entered the GUIElement or Collider.
void OnMouseOver() OnMouseOver is called every frame while the mouse is over the GUIElement or Collider.
void OnMouseExit() OnMouseExit is called when the mouse is not any longer over the GUIElement or Collider.
void OnMouseDown() OnMouseDown is called when the user has pressed the mouse button while over the GUIElement or Collider.
void OnMouseUp() OnMouseUp is called when the user has released the mouse button.
void OnMouseUpAsButton() OnMouseUpAsButton is only called when the mouse is released over the same GUIElement or Collider as it was pressed.
void OnMouseDrag() OnMouseDrag is called when the user has clicked on a GUIElement or Collider and is still holding down the mouse.
HEADER Playback
void OnLevelWasLoaded(int level) This function is called after a new level was loaded.
void OnApplicationFocus(bool focus) Sent to all game objects when the player gets or looses focus.
void OnApplicationPause(bool pause) Sent to all game objects when the player pauses.
void OnApplicationQuit() Sent to all game objects before the application is quit.
HEADER Rendering
void OnBecameVisible() OnBecameVisible is called when the renderer became visible by any camera.
void OnBecameInvisible() OnBecameInvisible is called when the renderer is no longer visible by any camera.
void OnPreCull() OnPreCull is called before a camera culls the scene.
void OnPreRender() OnPreRender is called before a camera starts rendering the scene.
void OnPostRender() OnPostRender is called after a camera finished rendering the scene.
void OnRenderObject() OnRenderObject is called after camera has rendered the scene.
void OnWillRenderObject() OnWillRenderObject is called once for each camera if the object is visible.
void OnRenderImage(RenderTexture source, RenderTexture destination) OnRenderImage is called after all rendering is complete to render image
HEADER Gizmos
void OnDrawGizmosSelected() Implement this OnDrawGizmosSelected if you want to draw gizmos only if the object is selected.
void OnDrawGizmos() Implement this OnDrawGizmos if you want to draw gizmos that are also pickable and always drawn.
HEADER Network
void OnPlayerConnected(NetworkPlayer player) Called on the server whenever a new player has successfully connected.
void OnServerInitialized() Called on the server whenever a Network.InitializeServer was invoked and has completed.
void OnConnectedToServer() Called on the client when you have successfully connected to a server.
void OnPlayerDisconnected(NetworkPlayer player) Called on the server whenever a player disconnected from the server.
void OnDisconnectedFromServer(NetworkDisconnection info) Called on the client when the connection was lost or you disconnected from the server.
void OnFailedToConnect(NetworkConnectionError error) Called on the client when a connection attempt fails for some reason.
void OnFailedToConnectToMasterServer(NetworkConnectionError info) Called on clients or servers when there is a problem connecting to the MasterServer.
void OnMasterServerEvent(MasterServerEvent msEvent) Called on clients or servers when reporting events from the MasterServer. 
void OnNetworkInstantiate(NetworkMessageInfo info) Called on objects which have been network instantiated with Network.Instantiate
void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info) Used to customize synchronization of variables in a script watched by a network view.

自定义功能

修改后的插件:链接:https://pan.baidu.com/s/1oa8r... 密码:6zln
修改或增加了以下功能:
1.修复了"UnityEditorInternal.InternalEditorUtility"的错误。
2.新增模板MyMono(拷贝C#的MonoBehaviour模板)。
3.默认选择自定义模板MyMono。
4.增加了当前创建日期。
5.可以删除注释(以前删除注释还会有//)。
6.增加了对访问修饰符的支持。
7.重新排序API。
8.打包版本Unity5.3.4。

自定义功能

相关文章:

多路IO复用模型 select epoll 等

同步阻塞IO在等待数据就绪上花去太多时间,而传统的同步非阻塞IO虽然不会阻塞进程,但是结合轮询来判断数据是否就绪仍然会耗费大量的CPU时间。多路IO复用提供了对大量文件描述符进行就绪检查的高性能方案。selectselect诞生于4.2BSD,在几乎所有…

可操作性强!Python实现一个电影订票系统!

来源丨Python小二一、效果展示通过Python实现一个电影订票系统,效果如下所示:二、整体结构图三、代码分解3.1 infos.py一部电影的详细信息适合用 字典 结构来存储,我们可以给字典里添加多个键值对来保存电影的名称、座位表和宣传时用的字符画…

centos7 install mysql

1. 下载mysql的repo源 $ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm 2. 安装mysql-community-release-el7-5.noarch.rpm包 $ sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm 安装这个包后,会获得两个mysql的yum repo源&#x…

unity加载ab后,场景shader不起效问题(物件表现黑色)

需要把unity自带的shader,加入到默认列表转载于:https://www.cnblogs.com/lancidie/p/9293827.html

Linux下各类TCP网络服务器的实现源代码

http://www.linuxeden.com/forum/t146870.html大家都知道各类网络服务器程序的编写步骤,并且都知道网络服务器就两大类:循环服务和并发服务。这里附上源代码来个小结吧。首先,循环网络服务器编程实现的步骤是这样的: 这种服务器模…

ReferenceQueue的使用

转:http://www.iflym.com/index.php/java-programe/201407140001.html 1 何为ReferenceQueue 在java的引用体系中,存在着强引用,软引用,虚引用,幽灵引用,这4种引用类型。在正常的使用过程中,我们…

红帽、Docker、SUSE 在俄罗斯停服

‍‍国际局势给技术圈带来的影响依然在蔓延。整理 | 苏宓出品 | CSDN(ID:CSDNnews)继 Oracle、Google、苹果等科技公司和 React 开源项目之后,如今 Linux 发行版也牵扯进俄乌之间冲突的漩涡中。其中一个是全球最大的独立开源软件公…

配置linux-Fedora系统下iptables防火墙

参考地址:https://blog.csdn.net/zhangjingyi111/article/details/78902820 本篇文章为实验课过程记录,较为简略。 1.查看系统是否安装iptables 命令:iptables --version 2.开启iptables 命令:service iptables start 出现错误&am…

output_buffering详细介绍

HTTP Header为什么要使用Output Buffering技术Output Buffering的工作原理基本用法高级用法使事情更为简单哈哈,我成功了我个人认为,Output buffering是比较纯粹的PHP4.0特征。尽管从概念上看来相当简单,但是output buffering功能非常强大&am…

12 个 Pandas 数据处理高频操作

作者 | 老表来源 | 简说Python今天给大家分享几个自己近期常用的Pandas数据处理技巧,主打实用,所以你肯定能用的着,建议扫一遍,然后收藏起来,下次要用的时候再查查看即可。简单说说总结分享统计一行/一列数据的负数出现…

ORACLE初次安装自动安装软件包

一、自动安装所需软件包提前配置好yum仓库定义package.txt包列表文件:以官网RHEL6为例,这里有compat-libstdc有两个包,如果不加*,号后面的compat-libstdc-33-3.2.3-69.el6.x86_64,compat-libstdc-296-2.96-144.el6.i68…

中文详解phpmailer所有对象和属性

2019独角兽企业重金招聘Python工程师标准>>> 2009-03-09 19:13:50 前言: phpmailer是一个优秀的发件程序,但中文资料比较少,于是有牛人手动翻译了phpmailer的elementindex.html,E文的:[url]http://www.bblog.com/api…

php error_reporting 详解

error_reporting设定错误讯息回报的等级。语法: int error_reporting(int [level]);传回值: 整数函式种类: PHP 系统功能内容说明 本函式用来设定错误讯息回报的等级,参数 level 是一个整数的位元遮罩 (bitmask),见下表。value constant 1 E_ERROR 2 E_W…

mysql多个实例

2019独角兽企业重金招聘Python工程师标准>>> 1>、关闭原有的默认端口3306的mysql:service mysqd stop 2>、拷贝或创建数据文件 cp -r /data/mysql/data1 /data/mysql/data_3307 格式 用bin/mysql_install_db --basedirmysql的目录 --datadir数据存放的目录 …

10行 python 代码做出哪些酷炫的事情?

来源 | Python小二Python凭借其简洁的代码,赢得了许多开发者的喜爱。因此也就促使了更多开发者用Python开发新的模块,从而形成良性循环,Python可以凭借更加简短的代码实现许多有趣的操作。下面我们来看看,我们用不超过10行代码能实…

这是一个不一样的社会公益活动

公益不是每个人的刚需,但是可以,以全链条模式联动更多人需求。 社会公益就是给社会带来帮助的事或物,它包含社区服务,环境保护,知识传播,公共福利,帮助他人,社会援助,社会…

剖析PHP中的输出缓冲

剖析PHP中的输出缓冲 本文按署名非商业用途保持一致授权作者: &#xff0c;发表于2005年12月24日01时54分 我们先来看一段代码。<?php for ($i10; $i>0; $i--) {echo $i;flush();sleep(1); } ?>按照php手册里的说法该函数将当前为止程序的所有输出发送到用户的浏览…

luasocket 安装记录 (FS1.6)

说明&#xff1a; 想通过Lua 脚本实现 http。默认 FS 的 mod_lua 中没有对socket 的支持&#xff0c;如下的操作为lua 添加 socket的支持。 一、下载 luasocket 包&#xff1a; # wget http://luaforge.net/frs/download.php/2664/luasocket-2.0.2.tar.gz # tar zxvf luaso…

5个实用的例子,一行 Python 能干嘛?

作者 | 菜鸟哥来源 | 菜鸟学Python一行Python到底能干嘛&#xff0c;今天给大家分享几个不错的小例子&#xff0c;都是在实际工作中经常会碰到的例子&#xff0c;让你知道一行代码的威力&#xff0c;让菜鸟也能秒变王者&#xff0c;尤其是能镇住新来的学妹。01、如果你是HR你手…

ASP.NET Web Forms - 网站导航(Sitemap 文件)

【参考】ASP.NET Web Forms - 导航 ASP.NET 带有内建的导航控件。 网站导航 维护大型网站的菜单是困难而且费时的。 在 ASP.NET 中&#xff0c;菜单可存储在文件中&#xff0c;这样易于维护。文件通常名为 web.sitemap&#xff0c;并且被存放在网站的根目录下。 此外&#xff0…

14 款命令行常用工具的替代品!

作者 | JackTian来源 | 杰哥的IT之旅在 Linux 操作系统下&#xff0c;ls (list) 可以说是我们日常使用率较高的命令了&#xff0c;它主要用来显示目标列表&#xff0c;输出信息可以进行彩色加亮显示&#xff0c;以分区不同类型的文件。关于 ls[1] 的语法、选项、实例、扩展知识…

C#编码实践:使用委托和特性调用指定函数

2019独角兽企业重金招聘Python工程师标准>>> 建立一个C#控制台应用程序AttributeTest。 建立一个类Operations&#xff0c;代码如下&#xff1a; namespace AttributeTest {public class Operations{public static int Add(int a, int b) { return a b; }public st…

HTTP响应头不缓存

Cache-Control:nocache Pragma:no-cache Expires&#xff1a;-1 <meta http-equivCache-Control content-1/>

CSS面试复习(三):预处理器、工程化方案、三大框架中的CSS

一、预处理器 1、介绍 基于CSS的另一种语言、通过工具编译成CSS、添加了很多CSS不具备的特性、能提升CSS文件的组织 2、less嵌套 3 、sass嵌套 4、 less变量 5、sass变量 6、less mixin 7、sass mixin 8、less extend 9、sass extend 10、less loop 11、sass loop 12、less imp…

用了这么久的 Python,居然没注意到这个操作

作者 | luanhz来源 | 小数志导读Python语言近年来的火热程度自不必说&#xff0c;这一方面得益于其庞大的第三方库的加持&#xff0c;使得其堪称万金油般的存在&#xff1b;另一方面也在于其简洁的语法和易用的函数。是的&#xff0c;Python语法之简洁和函数之丰富&#xff0c;…

apache的keepalive和keepalivetimeout(apache优化)

在APACHE的httpd.conf中&#xff0c;KeepAlive指的是保持连接活跃&#xff0c;类似于Mysql的永久连接。换一句话说&#xff0c;如果将KeepAlive设置为On&#xff0c;那么来自同一客户端的请求就不需要再一次连接&#xff0c;避免每次请求都要新建一个连接而加重服务器的负担。 …

讨论JDK的File.equal()

我们一般比较两个文件中的对象是相同的文件&#xff0c;通常使用java.io.File.equal()。这里&#xff0c;equal()是不是文件内容的比较结果为。象是否指向同一个文件。File的equal()方法。实际上调用了当前文件系统FileSystem的compareTo()。public boolean equals(Object obj)…

百度云满速下载(转)

BaiduPCS-GO下载完毕后可以存放到任何位置&#xff0c;建议存放到无中文目录内。然后打开我的电脑→属性→高级系统设置→环境变量→系统变量→Path→编辑→新建&#xff0c;输入你的BaiduPCS-Go存放目录。注意&#xff1a;是存放目录。 这样CMD才可以正确识别到程序。做好所有…

内容协商 (Content Negotiation)

大多数响应包含一个实体&#xff0c;此实体包含人类用户能理解的信息。通常&#xff0c;希望提供给用户相应于请求最容易得到的实体。对服务器和缓存来说&#xff0c;不幸的是&#xff0c;并不是所有的用户都对这个最容易得到的实体有喜好&#xff0c;并且并不是所有的用户代理…

[经验]无线鼠标和无线键盘真的不能用了?——雷柏的重生之路~

逆天大二的时候托朋友买了个雷柏的无线键盘鼠标&#xff1a; 用了很多年&#xff0c;不仅外观好而且键盘鼠标本身也很好用&#xff0c;可前些日子就光荣牺牲了。。。。 逆天百思不得其"姐"&#xff0c;试着把电池换了&#xff0c;发现还是不行&#xff0c;&#xff0…