Commit 27a64692 authored by xujr's avatar xujr

添加底部液体遮罩

parent 58c7edd6
fileFormatVersion: 2
guid: 38825ab71c54659468e5f574f1cc9806
ModelImporter:
serializedVersion: 19300
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 1
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 7a520dc542b6d204587b3538c14d2de4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
{
"name": "AssetUsageFinder",
"references": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": false,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
\ No newline at end of file
fileFormatVersion: 2
guid: 78166de3938470b4da415a0209d69308
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a6cb38742b49c2543b9129cc5bc1959f
folderAsset: yes
timeCreated: 1464798283
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace AssetUsageFinder {
public static class AufUtils {
public static Object[] LoadAllAssetsAtPath(string assetPath) {
// prevents error "Do not use readobjectthreaded on scene objects!"
return typeof(SceneAsset) == AssetDatabase.GetMainAssetTypeAtPath(assetPath)
? new[] {AssetDatabase.LoadMainAssetAtPath(assetPath)}
: AssetDatabase.LoadAllAssetsAtPath(assetPath);
}
public static T FirstOfType<T>() where T : Object {
var typeName = typeof(T).Name;
var guids = AssetDatabase.FindAssets(string.Format("t:{0}", typeName));
if (!guids.Any()) {
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
}
Asr.IsTrue(guids.Length > 0, string.Format("No '{0}' assets found", typeName));
return guids.Select(g => AssetDatabase.GUIDToAssetPath(g)).Select(t => (T) AssetDatabase.LoadAssetAtPath(t, typeof(T))).First();
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 67f83d816cd4ba344a82ea0cf924e446
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Diagnostics;
using UnityEngine;
using UnityEngine.Assertions;
namespace AssetUsageFinder {
static class FLAGS {
public const string DEBUG = "DEBUG1"; //todo rename in release
}
static class Asr {
#line hidden
[Conditional(FLAGS.DEBUG)]
public static void AreEqual(int a, int b) {
Assert.AreEqual(a, b);
}
[Conditional(FLAGS.DEBUG)]
public static void IsTrue(bool b, string format = null) {
Assert.IsTrue(b, format);
}
[Conditional(FLAGS.DEBUG)]
public static void IsFalse(bool b, string format = null) {
Assert.IsFalse(b, format);
}
[Conditional(FLAGS.DEBUG)]
public static void Fail(string format = null) {
throw new AssertionException("Failed", format);
}
[Conditional(FLAGS.DEBUG)]
public static void IsNotNull(Object target, string str) {
Assert.IsNotNull(target, str);
}
#line default
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 28cd7f324901405696fa9c87c25a1d2b
timeCreated: 1587623743
\ No newline at end of file
fileFormatVersion: 2
guid: 2181b913e8042f54db8354b4302d01f2
folderAsset: yes
timeCreated: 1467572757
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 939dee46ae9eef044b454d9a2f64719d
timeCreated: 1467571796
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 48b12aa9f8e67a5419b212fcae22754b
timeCreated: 1487778797
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 2
buildTargetSettings: []
spriteSheet:
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 93880ab424857034481dd201068f1f3c
timeCreated: 1467572760
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 0
linearTexture: 1
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: 1
mipBias: -1
wrapMode: 1
nPOTScale: 0
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 1
textureType: 2
buildTargetSettings: []
spriteSheet:
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: acc929cd151e60c4eaec2a88e8c36274
folderAsset: yes
timeCreated: 1488097356
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Linq;
using UnityEngine;
namespace AssetUsageFinder {
[Serializable]
public class AssetDependencies {
public string[] DependencyGuids;
public string HashString;
[NonSerialized] Hash128 _hashCache;
public Hash128 DependencyHash {
get { return _hashCache.Equals(default(Hash128)) ? Hash128.Parse(HashString) : _hashCache; }
set {
_hashCache = value;
HashString = value.ToString();
}
}
public bool Contains(string guid) {
return DependencyGuids.Any(d => StringComparer.InvariantCultureIgnoreCase.Equals(guid, d));
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: b4b690bbffa63544f9cc84b6b0bcbf18
timeCreated: 1486474181
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace AssetUsageFinder {
public class CacheManager {
Dictionary<string, AssetDependencies> _dict;
HashSet<string> _used;
// [MenuItem("Tools/LogPath")]
static void Log() {
Debug.Log(Application.temporaryCachePath);
}
public CacheManager() {
_dict = new Dictionary<string, AssetDependencies>(StringComparer.InvariantCultureIgnoreCase);
_used = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
}
public void Init() {
var serializable = Deserialize();
_dict = serializable.OnDeserialize();
}
static SerializableData Deserialize() {
SerializableData data;
string json;
if (!File.Exists(Path)) {
// not exists - write new
data = SerializableData.Empty();
json = JsonUtility.ToJson(data);
File.WriteAllText(Path, json);
}
else {
// exists
json = File.ReadAllText(Path);
if (string.IsNullOrEmpty(json)) {
// but corrupted - overwrite with new
data = SerializableData.Empty();
json = JsonUtility.ToJson(data);
File.WriteAllText(Path, json);
}
data = JsonUtility.FromJson<SerializableData>(json);
// todo assert valid
}
return data;
}
static string Path => $"{Application.temporaryCachePath}/AssetUsageFinder4.json";
public void Serialize() {
var data = SerializableData.OnSerialize(_dict);
var json = JsonUtility.ToJson(data);
File.WriteAllText(Path, json);
}
internal AssetDependencies Get(string path, string guid) {
_used.Add(guid);
if (_dict.TryGetValue(guid, out var res)) {
var assetDependencyHash = AssetDatabase.GetAssetDependencyHash(path);
if (assetDependencyHash.isValid && res.DependencyHash == assetDependencyHash) {
return res;
}
res = HashByPath();
_dict[guid] = res;
return res;
}
res = HashByPath();
_dict.Add(guid, res);
return res;
AssetDependencies HashByPath() {
var dependencyPaths = AssetDatabase.GetDependencies(path, true);
var guids = dependencyPaths.Select(AssetDatabase.AssetPathToGUID).ToArray();
return new AssetDependencies {
DependencyGuids = guids,
DependencyHash = AssetDatabase.GetAssetDependencyHash(path),
};
}
}
[Serializable]
public class SerializableData {
public const int CurrentVersion = 5; // for cache invalidation
public int Version;
public string[] Keys;
public AssetDependencies[] Values;
public static SerializableData Empty() => new SerializableData() {
Keys = new string[0],
Values = new AssetDependencies[0],
Version = CurrentVersion,
};
public static SerializableData OnSerialize(Dictionary<string, AssetDependencies> dict) {
return new SerializableData() {
Keys = dict.Keys.ToArray(),
Values = dict.Values.ToArray(),
Version = CurrentVersion,
};
}
public Dictionary<string, AssetDependencies> OnDeserialize() {
var res = new Dictionary<string, AssetDependencies>(StringComparer.InvariantCultureIgnoreCase);
var keysLength = Keys.Length;
for (var i = 0; i < keysLength; i++) res.Add(Keys[i], Values[i]);
return res;
}
public static bool Valid(SerializableData that) =>
that != null && CurrentVersion == that.Version && that.Keys != null && that.Values != null && that.Keys.Length == that.Values.Length;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: e70f0d094b7379b45a36f7fc76809b0a
timeCreated: 1486465336
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Object = UnityEngine.Object;
namespace AssetUsageFinder {
[Serializable]
abstract class DependencyAbstractFinder {
public SearchTarget Target;
public ResultRow[] Dependencies;
public GUIContent TabContent;
public DependencyAbstractFinder Parent;
public string Title = "";
public List<DependencyAbstractFinder> Parents() {
var res = new List<DependencyAbstractFinder>();
for (var cur = this; cur != null; cur = cur.Parent)
res.Add(cur);
return res;
}
public IEnumerable<ResultRow> Group(IEnumerable<ResultRow> inScenePro) {
ResultRow cur = null;
var res = new List<ResultRow>();
var list = inScenePro.OrderBy(t => t.Main.GetInstanceID());
var modificationsString = "Object.Modification.Modifications";
var correpsondingString = "CorrespondingSourceObject";
var gameObjectString = "GameObject";
foreach (var source in list.ToList()) {
if (cur == null || cur.Main != source.Main) {
cur = source;
var buf = source.Properties.Where(p =>
!p.Content.text.Contains(gameObjectString) &&
!p.Content.text.Contains(modificationsString) &&
!p.Content.text.Contains(correpsondingString)).ToList();
cur.Properties = buf;
res.Add(cur);
}
else {
foreach (var item in source.Properties) {
if (
!item.Content.text.Contains(gameObjectString) &&
!item.Content.text.Contains(modificationsString) &&
!item.Content.text.Contains(correpsondingString) &&
!cur.Properties.Any(p =>
p.Content.text == item.Content.text &&
p.Content.tooltip == p.Content.tooltip)) {
cur.Properties.Add(item);
}
}
}
}
return res;
}
public abstract void FindDependencies();
public abstract DependencyAbstractFinder Nest(Object o);
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 25951e74c3fd1cd40863089a51c157ce
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 8a6622c947e860548bd95915e407658e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Diagnostics;
using System.Linq;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
using UnityEngine.Assertions;
namespace AssetUsageFinder {
[Serializable]
sealed class FileDependencyFinder : DependencyAbstractFinder {
public class Pair {
public string NicifiedPath;
public string Path;
}
public Pair[] ScenePaths;
public FileDependencyFinder(Object target) {
Asr.IsTrue(target, "Asset you're trying to search is corrupted");
Target = new SearchTarget(target, FindModeEnum.File);
FindDependencies();
var path = AssetDatabase.GetAssetPath(Target.Target);
Title = path;
TabContent = new GUIContent {
text = target.name,
image = AssetDatabase.GetCachedIcon(path)
};
}
public override void FindDependencies() {
var files = DependencyFinderEngine.GetFilesThatReference(Target);
Dependencies = Group(files.Where(f => !(f.Target is SceneAsset)))
.OrderBy(t => t.LabelContent.text, StringComparer.Ordinal)
.ToArray();
}
public override DependencyAbstractFinder Nest(Object o) {
return new FileDependencyFinder(o) {Parent = this};
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 2c4b883461f4461438dae02eba435811
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
namespace AssetUsageFinder {
static class Globals<T> where T : class {
static T _instance;
public static void TryInit(Func<T> ctor) {
if (_instance != null) return;
_instance = ctor.Invoke();
}
public static T Get() => _instance;
public static T GetOrCreate(Func<T> ctor) {
TryInit(ctor);
return _instance;
}
public static void Set(T value) => _instance = value;
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 2dee75149ff4451a979163c53566150c
timeCreated: 1587621466
\ No newline at end of file
using System;
using System.Linq;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
namespace AssetUsageFinder {
[Serializable]
sealed class InSceneDependencyFinder : DependencyAbstractFinder {
[SerializeField] string _scenePath;
public InSceneDependencyFinder(Object target, string scenePath) {
Target = new SearchTarget(target, FindModeEnum.Scene, scenePath);
_scenePath = scenePath;
Title = scenePath;
var name = target is Component ? target.GetType().Name : target.name;
TabContent = new GUIContent {
text = name,
image = AssetPreview.GetMiniTypeThumbnail(Target.Target.GetType()) ?? AssetPreview.GetMiniThumbnail(Target.Target)
};
FindDependencies();
}
public override void FindDependencies() {
var dependenciesInScene = DependencyFinderEngine.GetDependenciesInScene(Target);
Dependencies = Group(dependenciesInScene).ToArray();
}
public override DependencyAbstractFinder Nest(Object o) {
return new InSceneDependencyFinder(o, _scenePath) {Parent = this};
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 925da3bd0dee034418ecb5cf800a3526
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Linq;
using UnityEditor;
using UnityEditor.Experimental.SceneManagement;
using UnityEngine;
using Object = UnityEngine.Object;
namespace AssetUsageFinder {
[Serializable]
sealed class InStageDependencyFinder : DependencyAbstractFinder {
[SerializeField] string _stagePath;
[SerializeField] PrefabStage _stage;
public InStageDependencyFinder(Object target, string stagePath) {
Target = new SearchTarget(target, FindModeEnum.Stage, stagePath);
_stagePath = stagePath;
_stage = Target.Stage;
Title = stagePath;
var name = target is Component ? target.GetType().Name : target.name;
TabContent = new GUIContent {
text = name,
image = AssetPreview.GetMiniTypeThumbnail(Target.Target.GetType()) ?? AssetPreview.GetMiniThumbnail(Target.Target)
};
FindDependencies();
}
public override void FindDependencies() {
Dependencies = Group(DependencyFinderEngine.GetDependenciesInStage(Target, _stage)).ToArray();
}
public override DependencyAbstractFinder Nest(Object o) {
return new InStageDependencyFinder(o, _stagePath) {Parent = this};
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 584109c30c0a0d849bbc12ec89d8c597
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
namespace AssetUsageFinder {
[Serializable]
class ResultRow {
[Serializable]
public class PropertyData {
public SerializedProperty Property;
public GUIContent Content;
}
public Object Target;
public SerializedObject SerializedObject;
public List<PropertyData> Properties = new List<PropertyData>();
public Object Root;
public GUIContent LabelContent = new GUIContent();
public GUIContent PropertyFieldContent = new GUIContent();
public Object Main;
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 40006b038ab829f4698bcebf3c1508f1
timeCreated: 1467625979
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Linq;
using UnityEditor;
using UnityEditor.Experimental.SceneManagement;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.SceneManagement;
using static AssetUsageFinder.PrefabUtilities;
using Object = UnityEngine.Object;
namespace AssetUsageFinder {
[Serializable]
class SearchTarget {
public Object Target;
public Option<Object[]> Nested;
public Object Root;
public Scene Scene;
public PrefabStage Stage;
public SearchTarget(Object target, FindModeEnum findMode, string sceneOrStagePath = null) {
Asr.IsNotNull(target, "Asset you're trying to search is corrupted");
Target = target;
var path = sceneOrStagePath ?? AssetDatabase.GetAssetPath(Target);
switch (findMode) {
case FindModeEnum.File:
Asr.IsTrue(string.IsNullOrEmpty(sceneOrStagePath));
Root = AssetDatabase.LoadMainAssetAtPath(path);
Nested = AufUtils.LoadAllAssetsAtPath(path);
break;
case FindModeEnum.Scene:
case FindModeEnum.Stage:
Root = Target;
if (Target is GameObject go) {
Nested = go.GetComponents<Component>().OfType<Object>().ToArray();
Stage = PrefabStageUtility.GetCurrentPrefabStage();
if (findMode == FindModeEnum.Scene) {
if (string.IsNullOrEmpty(sceneOrStagePath))
sceneOrStagePath = go.scene.path;
Scene = SceneManager.GetSceneByPath(sceneOrStagePath);
}
}
else if (Target is Component c) {
Nested = default;
if (findMode == FindModeEnum.Scene) {
if (string.IsNullOrEmpty(sceneOrStagePath))
sceneOrStagePath = c.gameObject.scene.path;
Scene = SceneManager.GetSceneByPath(sceneOrStagePath);
}
}
else {
Nested = default;
}
break;
}
}
public bool Check(Object t) {
var tt = Target == t;
return t && Nested.TryGet(out var n) && n.Aggregate(tt, (current, o) => current || o == t);
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: f500aea056165bb4294b484f1c9623d3
timeCreated: 1467656394
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: bcd1862681e4b684abaa15975a54cecf
timeCreated: 1464887183
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
namespace AssetUsageFinder {
class FileDependencyWindow : DependencyWindow {
public FileDependencyWindow() {
_findMode = FindModeEnum.File;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 227b60af61a13ef46ae80267f1a7626e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AssetUsageFinder {
public enum FindModeEnum {
Unknown = 0,
File = 1,
Scene = 2,
Stage = 3
}
public static class FindMode {
public static string GetWindowTitleByFindMode(FindModeEnum findMode) {
switch (findMode) {
case FindModeEnum.File:
return "Usages in Project";
case FindModeEnum.Scene:
return "Usages in Scene";
case FindModeEnum.Stage:
return "Usages in Stage";
default:
return "Unknown Title!";
}
}
public static string GetContentByFindMode(FindModeEnum findMode) {
switch (findMode) {
case FindModeEnum.File:
return "In Project Files";
case FindModeEnum.Scene:
return "In Current Scene";
case FindModeEnum.Stage:
return "In Current Stage";
default:
return "Unknown Content!";
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: fef0947ab998ac34f8ab0f1e2eae5d37
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace AssetUsageFinder {
[InitializeOnLoad]
public class GuiManager : UnityEditor.AssetModificationProcessor {
static string _version = "v4.0";
static GuiManager() {
EditorSceneManager.sceneSaved += OnSceneSaved;
}
static void OnSceneSaved(Scene scene) { }
public static string[] OnWillSaveAssets(string[] paths) {
return paths;
}
static void InitCache() {
Globals<CacheManager>.GetOrCreate(() => {
var res = new CacheManager();
res.Init();
return res;
});
}
#region Menu
[MenuItem("Assets/− Find Usages in Project", false, 30)]
static void FileMenu(MenuCommand command) {
InitCache();
var continueFinding = DoYouWantToSaveScene();
if (!continueFinding) return;
var pickupMessage = $"Please pick up a file from the project!";
var selected = Selection.activeObject;
var type = selected.GetType();
if (selected == null ||
type == typeof(DefaultAsset) ||
type == typeof(SceneAsset)) {
EditorUtility.DisplayDialog($"{_version}", $"{pickupMessage}", "Ok");
return;
}
if (type == typeof(GameObject)) {
var prefabProperties = PrefabUtilities.GetPrefabProperties(Selection.activeObject as GameObject);
if (prefabProperties.IsPartOfStage || prefabProperties.IsSceneObject) {
EditorUtility.DisplayDialog($"{_version}", $"{pickupMessage}", "Ok");
return;
}
}
EditorApplication.ExecuteMenuItem("File/Save Project");
OpenFileWindow(selected);
return;
}
[MenuItem("GameObject/− Find Usages in Scene && Stage", false, -1)]
public static void SceneOrStageMenu(MenuCommand data) {
InitCache();
var message = $"Please pick up an object from the scene && stage!";
var selected = Selection.activeObject;
if (selected == null || !(selected is GameObject)) {
EditorUtility.DisplayDialog($"{_version}", $"{message}", "Ok");
return;
}
var continueFinding = DoYouWantToSaveScene();
if (!continueFinding) return;
var prefabProperties = PrefabUtilities.GetPrefabProperties(Selection.activeObject as GameObject);
if (prefabProperties.IsPartOfStage) {
OpenStageWindow(selected, prefabProperties.Path);
}
else if (prefabProperties.IsSceneObject) {
OpenSceneWindow(selected, SceneManager.GetActiveScene().path);
}
else {
EditorUtility.DisplayDialog($"{_version}", $"{message}", "Ok");
return;
}
}
[MenuItem("CONTEXT/Component/− Find Usages of Component", false, 159)]
public static void FindReferencesToComponent(MenuCommand data) {
InitCache();
Object selected = data.context;
if (!selected) return;
var continueFinding = DoYouWantToSaveScene();
if (!continueFinding) return;
var scenePath = SceneManager.GetActiveScene().path;
OpenSceneWindow(selected, scenePath);
}
static bool DoYouWantToSaveScene() {
var scene = SceneManager.GetActiveScene();
if (scene.isDirty || string.IsNullOrEmpty(scene.path)) {
var response = EditorUtility.DisplayDialogComplex(
title: "Asset Usage Finder v4.0",
message: "Current scene is not saved yet!",
ok: "Save scene and find usages",
cancel: "Cancel usage finding",
alt: "Find without saving");
switch (response) {
case 0: // ok
EditorApplication.ExecuteMenuItem("File/Save");
return true;
case 1: // cancel
return false;
case 2: // find without saving
return true;
default:
return true;
}
}
return true;
}
#endregion Menu
#region InitWindow
static void OpenFileWindow(Object selected) {
var finder = new FileDependencyFinder(selected);
var window = ScriptableObject.CreateInstance<FileDependencyWindow>();
window.Init(finder);
var p = window.position;
p.size = DependencyWindow.StyleInstance.Size;
window.position = p;
window.Show();
}
public static void OpenSceneWindow(Object target, string scenePath) {
var finder = new InSceneDependencyFinder(target, scenePath);
var window = ScriptableObject.CreateInstance<SceneDependencyWindow>();
window.Init(finder);
window.Show();
}
static void OpenStageWindow(Object target, string stagePath) {
var finder = new InStageDependencyFinder(target, stagePath);
var window = ScriptableObject.CreateInstance<StageDependencyWindow>();
window.Init(finder);
window.Show();
}
#endregion InitWindow
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 65b7b313ed4025e4bbdf4f16a5d423de
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace AssetUsageFinder {
public static class Option {
public static Option<T> Some<T>(T value) => new Option<T>(value, true);
public static Option<T> None<T>() => new Option<T>(default, false);
public static bool IsNotNull<T>(T t) {
return Option<T>.IsValueType || t != null;
}
}
public struct Option<T> : IEquatable<Option<T>>, IComparable<Option<T>> {
// ReSharper disable once StaticMemberInGenericType
internal static readonly bool IsValueType;
public bool HasValue { get; }
T Value { get; }
public static implicit operator Option<T>(T arg) {
if (!IsValueType) return ReferenceEquals(arg, null) ? new Option<T>() : Option.Some(arg);
#if M_WARN
if (arg.Equals(default(T)))
Warn.Warning($"{arg} has default value");
#endif
return Option.Some(arg);
}
static Option() {
IsValueType = typeof(T).IsValueType;
}
public void GetOrFail(out T value) {
if (!TryGet(out value))
Fail($"Option<{typeof(T).Name}> has no value");
}
public T GetOrFail() {
if (!TryGet(out var value))
Fail($"Option<{typeof(T).Name}> has no value");
return value;
}
[Conditional("DEBUG1")]
static void Fail(string format = null) {
throw new Exception(format);
}
public bool TryGet(out T value) {
if (!HasValue) {
value = default(T);
return false;
}
value = Value;
return true;
}
internal Option(T value, bool hasValue) {
Value = value;
HasValue = hasValue;
}
public T ValueOr(T alternative) {
return HasValue ? Value : alternative;
}
// for debug purposes
public override string ToString() {
if (!HasValue) return "None";
return Value == null ? "Some(null)" : $"Some({Value})";
}
#region eq comparers boilerplate
public bool Equals(Option<T> other) {
if (!HasValue && !other.HasValue)
return true;
if (HasValue && other.HasValue)
return EqualityComparer<T>.Default.Equals(Value, other.Value);
return false;
}
public override bool Equals(object obj) {
return obj is Option<T> && Equals((Option<T>) obj);
}
public static bool operator ==(Option<T> left, Option<T> right) {
return left.Equals(right);
}
public static bool operator !=(Option<T> left, Option<T> right) {
return !left.Equals(right);
}
public override int GetHashCode() {
if (!HasValue) return 0;
return Option.IsNotNull(Value) ? Value.GetHashCode() : 1;
}
public int CompareTo(Option<T> other) {
if (HasValue && !other.HasValue) return 1;
if (!HasValue && other.HasValue) return -1;
return Comparer<T>.Default.Compare(Value, other.Value);
}
public static bool operator <(Option<T> left, Option<T> right) {
return left.CompareTo(right) < 0;
}
public static bool operator <=(Option<T> left, Option<T> right) {
return left.CompareTo(right) <= 0;
}
public static bool operator >(Option<T> left, Option<T> right) {
return left.CompareTo(right) > 0;
}
public static bool operator >=(Option<T> left, Option<T> right) {
return left.CompareTo(right) >= 0;
}
#endregion
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: ae4b8392ac17499b9840c83d49357e45
timeCreated: 1591797332
\ No newline at end of file
#if UNITY_2018_3_OR_NEWER
using UnityEditor;
using UnityEditor.Experimental.SceneManagement;
using UnityEngine;
namespace AssetUsageFinder {
public static class PrefabUtilities {
public class PrefabProperties {
public bool IsPartOfStage;
public bool IsStageRoot;
public bool IsPartOfInstance;
public bool IsInstanceRoot;
public GameObject NearestInstanceRoot;
public bool IsAssetRoot;
public bool IsPartOfPrefabAsset;
public string Path;
public GameObject PrefabAssetRoot;
public bool IsSceneObject => (!IsPartOfPrefabAsset && !IsPartOfStage);
public bool IsPartOfAnyPrefab => Path != null;
public bool IsRootOfAnyPrefab => IsAssetRoot || IsInstanceRoot || IsStageRoot;
}
public static PrefabProperties GetPrefabProperties(GameObject gameObject) {
var p = new PrefabProperties();
p.IsPartOfPrefabAsset = PrefabUtility.IsPartOfPrefabAsset(gameObject);
if (!p.IsPartOfPrefabAsset)
p.IsPartOfPrefabAsset = !string.IsNullOrEmpty(AssetDatabase.GetAssetPath(gameObject));
GameObject nerestInstanceRoot = p.NearestInstanceRoot = PrefabUtility.GetNearestPrefabInstanceRoot(gameObject);
p.IsPartOfInstance = (nerestInstanceRoot != null);
p.IsInstanceRoot = (gameObject == nerestInstanceRoot);
if (p.IsPartOfPrefabAsset) {
p.PrefabAssetRoot = gameObject.transform.root.gameObject;
p.IsAssetRoot = (gameObject == p.PrefabAssetRoot);
}
var editorPrefabStage = PrefabStageUtility.GetCurrentPrefabStage();
if (editorPrefabStage != null) {
if (p.IsPartOfPrefabAsset == false)
p.IsPartOfStage = true;
if (p.IsPartOfStage && gameObject.transform.parent == null)
p.IsStageRoot = true;
}
if (p.IsRootOfAnyPrefab) {
if (p.IsStageRoot) {
p.Path = editorPrefabStage.prefabAssetPath;
}
else if (p.IsInstanceRoot) {
p.Path = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(gameObject);
}
else if (p.IsAssetRoot) {
p.Path = AssetDatabase.GetAssetPath(gameObject);
}
}
else {
if (p.IsPartOfStage) {
p.Path = editorPrefabStage.prefabAssetPath;
}
else if (p.IsPartOfInstance) {
p.Path = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(p.NearestInstanceRoot);
}
else if (p.IsPartOfPrefabAsset) {
p.Path = AssetDatabase.GetAssetPath(gameObject.transform.root.gameObject);
}
}
return p;
}
}
}
#endif
\ No newline at end of file
fileFormatVersion: 2
guid: 40e15ba4381bc524f9aa96a02e671466
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
namespace AssetUsageFinder {
class SceneDependencyWindow : DependencyWindow {
public SceneDependencyWindow() {
_findMode = FindModeEnum.Scene;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: a6fa5c0e12d3f2d4eaeda43544061720
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
namespace AssetUsageFinder {
class StageDependencyWindow : DependencyWindow {
public StageDependencyWindow() {
_findMode = FindModeEnum.Stage;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: e4dcf69ebb96d694883ee0b402596bb2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 479a256622980e149b2c447e4d2939fb
folderAsset: yes
timeCreated: 1470315057
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
using System;
using UnityEngine;
namespace AssetUsageFinder.Styles {
[Serializable]
class ContentStylePair {
public GUIContent Content = new GUIContent();
public GUIStyle Style = new GUIStyle();
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: d89a773ebe3631a45968846ae15ffe67
timeCreated: 1467636613
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
namespace AssetUsageFinder.Styles {
class WindowStyleAsset : ScriptableObject {
#pragma warning disable 0649
public DependencyWindow.Style Pro;
public DependencyWindow.Style Personal;
#pragma warning restore
#if !false
[CustomEditor(typeof (WindowStyleAsset))]
class Editor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
EditorGUI.BeginChangeCheck();
base.OnInspectorGUI();
if (EditorGUI.EndChangeCheck())
InternalEditorUtility.RepaintAllViews();
}
}
#endif
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 2a8038d7a393d814b887bec61ad77979
timeCreated: 1467571260
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Features in v4.12:
1) Improved work with cache persistence
2) Fixed minor component search bugs
3) 2018.4+ version support added
4) Fixed Usages search edgecase bug - When target is a component of prefab instance in scene
Features in v4.0:
1) Full Unity 2018+ compatibility - Nested prefabs support added
2) Search for AnimatorController states
3) Open Scene search
4) Minor UX and functional improvements
5) User Support boosted! Support via messenger (get an answer under 12 hours) - Telegram channel https://t.me/joinchat/BdWObFckBlxZOW06Unnv6w
\ No newline at end of file
fileFormatVersion: 2
guid: 994604101a3fe5b40baa74ad0b0519f3
timeCreated: 1490728548
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment