https://github.com/solidalloy/missingscripttype
Find missing scripts more easily
https://github.com/solidalloy/missingscripttype
Last synced: 11 months ago
JSON representation
Find missing scripts more easily
- Host: GitHub
- URL: https://github.com/solidalloy/missingscripttype
- Owner: SolidAlloy
- License: other
- Created: 2022-02-11T21:48:38.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-24T21:14:05.000Z (about 4 years ago)
- Last Synced: 2025-07-20T09:48:51.907Z (about 1 year ago)
- Language: C#
- Homepage:
- Size: 27.3 KB
- Stars: 62
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# MissingScriptType
Find missing scripts in your components and ScriptableObjects more easily by knowing their type.
[](https://openupm.com/packages/com.solidalloy.missing-script-type/)
## Installation
### Install with OpenUPM
Once you have the [OpenUPM cli](https://github.com/openupm/openupm-cli#installation), run the following command:
```openupm install com.solidalloy.missing-script-type```
Or if you don't have it, add the scoped registry to manifest.json with the desired dependency semantic version:
```json
"scopedRegistries": [
{
"name": "package.openupm.com",
"url": "https://package.openupm.com",
"scopes": [
"com.solidalloy",
"com.openupm"
]
}
],
"dependencies": {
"com.solidalloy.missing-script-type": "1.0.1"
},
```
### Install via Package Manager
Project supports Unity Package Manager. To install the project as a Git package do the following:
1. In Unity, open **Project Settings** -> **Package Manager**.
2. Add a new scoped registry with the following details:
- **Name**: package.openupm.com
- **URL**: https://package.openupm.com
- Scope(s):
- com.openupm
- com.solidalloy
3. Hit **Apply**.
4. Go to **Window** -> **Package Manager**.
5. Press the **+** button, *Add package from git URL*.
6. Enter **com.solidalloy.missing-script-type**, press **Add**.
## Quick Start
When you stumble upon a MonoBehaviour or ScriptableObject with a missing script, it will now look like this:

You will see the type name of the script that had been assigned to this object before it went missing. Note that it will only for the objects where the script had been lost before the package was installed. If the package is installed after the object missed its script, the type field will be empty.
The plugin also searches for a script that contains this type. If the script is found, it will appear on the next line, and you will be able to restore the object in one button press:

## Customization
You can customize how the type name is shown in **Project Settings/Packages/Missing Script Type**:

**Short** - TestBehaviour
**Full** (default) - DefaultNamespace.TestBehaviour
**Full And Assembly** - DefaultNamespace.TestBehaviour, Assembly-CSharp
## Integrations With Other Plugins
The plugin works with **Odin Inspector**. When the object script is loaded, you will see the normal Odin interface. When the script is missing, you will be able to see its type.
There is also integration with [GenericUnityObjects](https://github.com/SolidAlloy/GenericUnityObjects):

## Using In Custom Inspectors
The plugin works through the custom editor called `MissingScriptTypeEditor` which is enabled for all MonoBehaviours and ScriptableObjects that don't have their own custom editor.
If you have a custom editor in which you want to implement the "Last Known Type" feature, you can inherit from `MissingScriptTypeEditor`:
```csharp
[CustomEditor(typeof(MyClass))]
public class MyCustomEditor : MissingScriptTypeEditor
{
protected override OnEnable()
{
base.OnEnable();
// your custom enable code
}
public override void OnInspectorGUI()
{
if (_missingScriptUtility.IsScriptLoaded())
{
// your custom inspector UI
}
else
{
_missingScriptUtility.Draw();
}
}
}
```
Or use `MissingScriptTypeUtility`:
```csharp
[CustomEditor(typeof(MyClass))]
public class MyCustomEditor : Editor
{
private MissingScriptTypeUtility _missingScriptUtility;
protected override OnEnable()
{
_missingScriptUtility = new MissingScriptTypeUtility(serializedObject);
}
public override void OnInspectorGUI()
{
if (_missingScriptUtility.IsScriptLoaded())
{
// your custom inspector UI
}
else
{
_missingScriptUtility.Draw();
}
}
}
```
If you have another custom editor that you want to use on general MonoBehaviours and ScriptableObjects, you can disable `MissingScriptTypeEditor` by adding `DISABLE_MISSING_SCRIPT_EDITOR` to **Player/Scripting Define Symbols**.