Small code cleanup

This commit is contained in:
2026-01-15 17:27:52 +00:00
parent 08bde0da45
commit 6fb0c358e1
3 changed files with 15 additions and 14 deletions

View File

@@ -29,6 +29,7 @@
#if UNITY_EDITOR
using System;
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
@@ -44,10 +45,10 @@ namespace Ext.B83.Unity.Editor.PropertyDrawers
static MonoScriptPropertyDrawer()
{
m_ScriptCache = new Dictionary<string, MonoScript>();
var scripts = Resources.FindObjectsOfTypeAll<MonoScript>();
MonoScript[] scripts = Resources.FindObjectsOfTypeAll<MonoScript>();
for (int i = 0; i < scripts.Length; i++)
{
var type = scripts[i].GetClass();
Type type = scripts[i].GetClass();
if (type != null && !m_ScriptCache.ContainsKey(type.FullName))
{
m_ScriptCache.Add(type.FullName, scripts[i]);
@@ -84,7 +85,7 @@ namespace Ext.B83.Unity.Editor.PropertyDrawers
{
if (script != null)
{
var type = script.GetClass();
Type type = script.GetClass();
MonoScriptAttribute attr = (MonoScriptAttribute)attribute;
if (attr.type != null && !attr.type.IsAssignableFrom(type))
type = null;