Added Pacore

This commit is contained in:
2026-03-30 10:32:44 +01:00
parent 62f6553986
commit b3202a4636
55 changed files with 1142 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using System;
namespace PashaBibko.Pacore.Editor.Caches
{
public static class MonoScriptCache
{
private static Dictionary<string, MonoScript> Cache { get; } = new();
static MonoScriptCache()
{
/* Finds all MonoScripts and adds them to the dictionary by name */
MonoScript[] scripts = Resources.FindObjectsOfTypeAll<MonoScript>();
foreach (MonoScript script in scripts)
{
Type scriptType = script.GetClass();
if (scriptType is not null)
{
string name = scriptType.FullName;
Cache.TryAdd(name, script);
}
}
}
public static MonoScript Get(string name)
{
/* Fetches the value (if there is one) without creating a default val */
Cache.TryGetValue(name, out MonoScript script);
return script;
}
}
}