Unity实现脚本插件[Script Create Dialog]图文详解

自动生成脚本的插件[script create dialog],大概是名字起的和脚本生成器相差太多,现在的开发工具又太强大,所以被埋没了。所支持的unity版本 3.4.2及以上,远古时期遗留的资源。试用了一下,感觉要是刚学unity脚本的时候有这个插件,能省下很多读api的时间。

最近写代码又犯懒了…
感觉每次新建脚本都要写一堆简单重复的东西好无聊,所以搜索了一下有没有自动生成脚本的插件。

插件效果

1.jpg

使用方式

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

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

如果导入插件后出现以下错误:
2.pngAssets/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…打开窗口使用。
a.png

b.png

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

BASECLASS=MonoBehaviourusing 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 Physicsvoid 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 Mousevoid 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 Playbackvoid 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 Renderingvoid 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 imageHEADER Gizmosvoid 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 Networkvoid 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.Instantiatevoid 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。

c.png

相关文章:

脚本动态生成VML_VML相关

相关视频:

BootStrap插件讲解视频教程

以上就是Unity实现脚本插件[Script Create Dialog]图文详解的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1432764.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2025年12月17日 08:35:43
下一篇 2025年12月17日 08:35:56

相关推荐

  • 关于c++中的引用总结

    c++70c2ad6247a753>本次的这篇文章主要是和大家分享了关于c++中的引用总结 ,有需要的小伙伴可以看一下. 引用总结   (1)在引用的使用中,单纯给某个变量取个别名是毫无意义的,引用的目的主要用于在函数参数传递中,解决大块数据或对象的传递效率和空间不如意的问题。   (2)用引…

    好文分享 2025年12月17日
    000
  • c++如何获取数值极值的办法

    c++70c2ad6247a753>这篇文章主要介绍了c++如何获取数值极值的办法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧 include #include using namespace std;#define L_VALUE(a) (cout<&l…

    2025年12月17日
    000
  • C#开发之微信小程序发送模板消息功能

    这篇文章主要介绍了c#开发之微信小程序发送模板消息功能,需要的朋友可以参考下 步骤一:获取模板ID 有两个方法可以获取模版ID 通过模版消息管理接口获取模版ID 在微信公众平台手动配置获取模版ID 步骤二:页面的 组件,属性report-submit为true时,可以声明为需发模板消息,此时点击按钮…

    2025年12月17日
    000
  • C++11多线程编程基础入门

    c++bce3b83f770dfdf50c5dae0e4360a>1.在C++11中创建新线程   在每个c++应用程序中,都有一个默认的主线程,即main函数,在c++11中,我们可以通过创建std::thread类的对象来创建其他线程,每个std :: thread对象都可以与一个线程相关…

    好文分享 2025年12月17日
    000
  • 关于C#中字典Dictionary的顺序及倒序详解

    C# .net 3.5 以上的版本引入 Linq 后,字典Dictionary排序变得十分简单,用一句类似 sql 数据库查询语句即可搞定;不过,.net 2.0 排序要稍微麻烦一点,为便于使用,将总结 .net 3.5 和 2.0 的排序方法。 一、创建字典Dictionary 对象   假如 D…

    好文分享 2025年12月17日
    000
  • C#中关于概念系统的总结

    font-size:14px”>1.什么是.net.net是由microsoft推出的应用程序开发平台,可用来构建和运行新一代microsoft windows和web应用程序。 2. .net的核心技术.net framework:.net 平台核心中的核心,为.net 平台下的…

    好文分享 2025年12月17日
    000
  • C#开发者必须知道的13件事情

    c#开发者必须知道的13件事情 1.开发流程 程序的Bug与瑕疵往往出现于开发流程当中。只要对工具善加利用,就有助于在你发布程序之前便将问题发现,或避开这些问题。 标准化代码书写 标准化代码书写可以使代码更加易于维护,尤其是在代码由多个开发者或团队进行开发与维护时,这一优点更加突出。常见的强制代码规…

    2025年12月17日
    000
  • C#实现导入导出Excel数据的两种方法详解

    这篇文章主要为大家详细介绍了c#导入导出excel数据的两种方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下 本文为大家分享了C#导入导出Excel数据的具体代码,供大家参考,具体内容如下 注:对于实体类对象最好新建一个并且继承原有实体类,这样可以将类型进行修改; 方法一:此种方法是用EPPL…

    好文分享 2025年12月17日
    000
  • c#DevExpress gridcontrol日期行的显示格式设置详解(图文)

    这篇文章主要介绍了c# devexpress gridcontrol日期行的显示格式设置,需要的朋友可以参考下 如上图所示,日期显示为”MM月DD日”,或者其它格式,比如显示年、月、日 或 年月日带时间,设置如下: 1、如下图设置,日期为d,时间为t: 2、在事件里面如下写法…

    2025年12月17日 好文分享
    000
  • c# GridControl的模糊查询实现代码实例

    这篇文章主要介绍了c# gridcontrol的模糊查询实现代码,需要的朋友可以参考下 如上图所示,如果查询供应商名称包括机械的公司,正常设置是不可以的,只能从头开始筛选: 方法1: 以下是以为网名为[不是小宽]的网友发给我的完美解决方案,我在此贴出来,大家可以共同学习: /// /// 设置gir…

    2025年12月17日
    000
  • 详细介绍C# string格式的日期时间字符串转为DateTime类型的方法

    这篇文章主要介绍了c# string格式的日期时间字符串转为datetime类型的方法,需要的朋友可以参考下 方法一:Convert.ToDateTime(string) string格式有要求,必须是yyyy-MM-dd hh:mm:ss 方法二:Convert.ToDateTime(string…

    好文分享 2025年12月17日
    000
  • 详解c#Winform程序自动更新实现方法(图)

    winform程序自动更新我也是第一次做,网上找了自动更新的源码,后来又根据在网上看到的一些方法,自己试了很久,最终还是有写错误,所以花了钱让别人帮忙调试成功的,下面是我自己捣腾出来的,方便大家借鉴,如果有什么错误的地方欢迎指正 Winform程序自动更新我也是第一次做,网上找了自动更新的源码,后来…

    2025年12月17日 好文分享
    000
  • C#泛型类型的详细介绍

    这篇文章主要介绍c#泛型类型,非常不错,具有参考借鉴价值,需要的朋友可以参考下 上篇文章给大家介绍了浅析C# 中的类型系统(值类型和引用类型),接下来通过本文给大家介绍下c# 泛型类型, 说下C#中的泛型,熟练地使用泛型能提高代码的重用性,使用我们代码瞬间就高大上了,当然只有一点点,真的只有一点点,…

    2025年12月17日
    000
  • C#中的类型系统(值类型和引用类型)的简单介绍

    这篇文章主要介绍了浅析c# 中的类型系统(值类型和引用类型),需要的朋友可以参考下 今天要写的东西都是书中一些概念性的东西,就当抄笔记,以提问对话的方式将其写出来吧,说不定以后面试能有点谈资~~~   Q1.C#1系统类型包含哪三点特性?   A1.C#1类型系统是静态的、显式的和安全的。   Q2…

    好文分享 2025年12月17日
    000
  • 实现C#中图片.BYTE[]和base64string的转换方法的详解

    下面小编就为大家带来一篇c#中图片.byte[]和base64string的转换方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧 在C#中      图片到byte[]再到base64string的转换: Bitmap bmp = new Bitmap(filepa…

    好文分享 2025年12月17日
    000
  • 详解C#接口在派生类和外部类中的调用方法示例

    这篇文章主要介绍了c#接口在派生类和外部类中的调用方法,结合实例形式分析了c#接口的定义与具体使用方法,需要的朋友可以参考下 本文实例讲述了C#接口在派生类和外部类中的调用方法。分享给大家供大家参考,具体如下: C#的接口通过interface关键字进行创建,在接口中可以包含属性,方法等成员变量。接…

    好文分享 2025年12月17日
    000
  • 详细介绍C#代码与javaScript函数的相互调用

    C#代码与JavaScript函数的相互调用 问:1.如何在javascript访问c#函数?2.如何在javascript访问c#变量?3.如何在c#中访问javascript的已有变量?4.如何在c#中访问javascript函数? 问题1答案如下:javascript函数中执行c#代码中的函数…

    好文分享 2025年12月17日
    000
  • C#解析XML文件的代码实例分享

    c#解析xml文件的代码实例分享 XmlNodeReader reader = null; try { XmlDocument xd = new XmlDocument(); xd.Load(filename); reader = new XmlNodeReader(xd); //创建新的XML r…

    好文分享 2025年12月17日
    000
  • c#ref关键字的示例代码分享

    c# 语言参考 ref(C# 参考) ref 关键字使参数按引用传递。其效果是,当控制权传递回调用方法时,在方法中对参数所做的任何更改都将反映在该变量中。若要使用 ref 参数,则方法定义和调用方法都必须显式使用 ref 关键字。例如:  复制代码 class RefExample{ static …

    好文分享 2025年12月17日
    000
  • 具体介绍C#线程与线程池的区别

    线程的建立:(不同于java的是不用再继承thread类) TcpClient tc = tListener.AcceptTcpClient(); CThreadServer ctserver = new CThreadServer(tc); Thread t = new Thread(new Th…

    好文分享 2025年12月17日
    000

发表回复

登录后才能评论
关注微信