Home  >  Article  >  Backend Development  >  Unity implements script plug-in [Script Create Dialog] with detailed graphic and text explanation

Unity implements script plug-in [Script Create Dialog] with detailed graphic and text explanation

php是最好的语言
php是最好的语言Original
2018-07-27 11:11:593065browse

The plug-in that automatically generates scripts [Script Create Dialog] is probably named because it is too different from the script generator, and the current development tools are too powerful, so it was buried. Supported Unity version 3.4.2 and above, resources left over from ancient times. After trying it out, I feel that if I had this plug-in when I first learned Unity scripting, it would have saved a lot of time in reading the API.

I’ve been too lazy to write code recently...
I feel like it’s boring to write a bunch of simple and repetitive things every time I create a new script, so I searched for a plug-in that automatically generates scripts.

Plug-in effect

Unity implements script plug-in [Script Create Dialog] with detailed graphic and text explanation

Usage method

1. Download my modified plug-in
Link: https://pan.baidu.com/s/1oa8r... Password: 6zln

2. Download the official plug-in and fix the script error
Official download address: https:/ /assetstore.unity.com/...

If the following error occurs after importing the plug-in:
Unity implements script plug-in [Script Create Dialog] with detailed graphic and text explanationAssets/CreateScriptDialog/Editor/NewScriptWindow.cs(454,47): error CS0117: UnityEditorInternal.InternalEditorUtility' does not contain a definition for AddScriptComponentUnchecked'

Change the error code to:

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. Right-click and use
Assets Right-click on the window>Create>Script... to open the window for use.
Unity implements script plug-in [Script Create Dialog] with detailed graphic and text explanation

Unity implements script plug-in [Script Create Dialog] with detailed graphic and text explanation

4. You can customize the new script template
Instructions for use can be seen in ReadMe.html.
The method template can be seen in MonoBehaviour.functions.txt. Custom templates can be added based on rules.

BASECLASS=MonoBehaviour
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class $ClassName : MonoBehaviour {
    
    $Functions
}
rrree

Custom function

Modified plug-in: Link: https://pan.baidu.com/s/1oa8r... Password: 6zln
The following functions have been modified or added:
1. Fixed the error of "UnityEditorInternal.InternalEditorUtility".
2. Add a new template MyMono (copy the C# MonoBehaviour template).
3. The custom template MyMono is selected by default.
4. Added current creation date.
5. You can delete comments (before deleting comments, there will still be //).
6. Added support for access modifiers.
7. Reorder API.
8. Packaged version Unity5.3.4.

Unity implements script plug-in [Script Create Dialog] with detailed graphic and text explanation

Related articles:

Script dynamically generates VML_VML related

Related videos:

BootStrap plug-in explanation video tutorial

The above is the detailed content of Unity implements script plug-in [Script Create Dialog] with detailed graphic and text explanation. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn