Reputation: 13952
I am using Unity3d in game development. For every project I can extend editor. How to extend Unity3d editor (for all projects, not for custom project)?
Upvotes: 8
Views: 919
Reputation: 257
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using System.IO;
public class MenuSystem : Editor
{
[MenuItem("Backup/Take Backup")]
public static void ExportBackUp()
{
string[] paths = new string[]
{
"Assets"
};
Debug.Log(paths);
AssetDatabase.ExportPackage(paths, "Backup.unitypackage", ExportPackageOptions.Recurse);
}
}
Upvotes: 2
Reputation: 21
Depending on what you need, you can also use Property Drawers, introduced in Unity 4 it allows you to override your property's default inspector without writing a whole new inspector. And it works on both existing types or the custom ones you created.
You can even set variables in the attribute to customize the way you can edit each occurrence.
More informations here : https://docs.unity3d.com/Manual/editor-PropertyDrawers.html
Upvotes: 1
Reputation: 2019
For plugins intended to be used in many projects, but not changed in that project. Some people choose to build the plugin into a dll, then place the dll in the project rather than it's source code.
http://docs.unity3d.com/Manual/UsingDLL.html
Upvotes: 5
Reputation: 20038
There is no real way to make a permanent extension (i.e. an extension that is there for every new project). You can however export your extension as a Unity package and import this whenever you create a new project. As per the documenentation on the linked page:
- In the Project View, select all the asset files you want to export.
- Choose Assets->Export Package... from the menubar.
- Name and save the package anywhere you like.
- Open the project you want to bring the assets into.
- Choose Assets->Import Package... from the menubar.
- Select your package file saved in step 3.
That should be the simplest way to easily import your custom extensions into each project.
Upvotes: 16