mirror of
https://github.com/yasirkula/UnityAssetUsageDetector.git
synced 2026-11-19 14:32:37 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7b291b2190 |
@@ -24,6 +24,11 @@
|
|||||||
"name": "com.unity.visualeffectgraph",
|
"name": "com.unity.visualeffectgraph",
|
||||||
"expression": "0.0.0",
|
"expression": "0.0.0",
|
||||||
"define": "ASSET_USAGE_VFX_GRAPH"
|
"define": "ASSET_USAGE_VFX_GRAPH"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.unity.ugui",
|
||||||
|
"expression": "0.0.0",
|
||||||
|
"define": "ASSET_USAGE_UGUI"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"noEngineReferences": false
|
"noEngineReferences": false
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ using UnityEditor.AddressableAssets.Settings;
|
|||||||
#endif
|
#endif
|
||||||
using UnityEditor.Animations;
|
using UnityEditor.Animations;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
#if ASSET_USAGE_UGUI
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
#endif
|
||||||
using UnityEngine.U2D;
|
using UnityEngine.U2D;
|
||||||
using UnityEngine.Playables;
|
using UnityEngine.Playables;
|
||||||
using UnityEditor.U2D;
|
using UnityEditor.U2D;
|
||||||
@@ -1642,11 +1644,13 @@ namespace AssetUsageDetectorNamespace
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Additional filtering for fields:
|
// Additional filtering for fields:
|
||||||
|
#if ASSET_USAGE_UGUI
|
||||||
// 1- Ignore "m_RectTransform", "m_CanvasRenderer" and "m_Canvas" fields of Graphic components
|
// 1- Ignore "m_RectTransform", "m_CanvasRenderer" and "m_Canvas" fields of Graphic components
|
||||||
string fieldName = field.Name;
|
string fieldName = field.Name;
|
||||||
if( typeof( Graphic ).IsAssignableFrom( currType ) &&
|
if( typeof( Graphic ).IsAssignableFrom( currType ) &&
|
||||||
( fieldName == "m_RectTransform" || fieldName == "m_CanvasRenderer" || fieldName == "m_Canvas" ) )
|
( fieldName == "m_RectTransform" || fieldName == "m_CanvasRenderer" || fieldName == "m_Canvas" ) )
|
||||||
continue;
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
VariableGetVal getter = field.CreateGetter( type );
|
VariableGetVal getter = field.CreateGetter( type );
|
||||||
if (getter != null)
|
if (getter != null)
|
||||||
@@ -1682,10 +1686,12 @@ namespace AssetUsageDetectorNamespace
|
|||||||
if( typeof( Component ).IsAssignableFrom( currType ) && ( propertyName == "gameObject" ||
|
if( typeof( Component ).IsAssignableFrom( currType ) && ( propertyName == "gameObject" ||
|
||||||
propertyName == "transform" || propertyName == "attachedRigidbody" || propertyName == "rectTransform" ) )
|
propertyName == "transform" || propertyName == "attachedRigidbody" || propertyName == "rectTransform" ) )
|
||||||
continue;
|
continue;
|
||||||
|
#if ASSET_USAGE_UGUI
|
||||||
// Ignore "canvasRenderer" and "canvas" properties of Graphic components to get more useful results
|
// Ignore "canvasRenderer" and "canvas" properties of Graphic components to get more useful results
|
||||||
else if( typeof( Graphic ).IsAssignableFrom( currType ) &&
|
else if( typeof( Graphic ).IsAssignableFrom( currType ) &&
|
||||||
( propertyName == "canvasRenderer" || propertyName == "canvas" ) )
|
( propertyName == "canvasRenderer" || propertyName == "canvas" ) )
|
||||||
continue;
|
continue;
|
||||||
|
#endif
|
||||||
// Prevent accessing properties of Unity that instantiate an existing resource (causing memory leak)
|
// Prevent accessing properties of Unity that instantiate an existing resource (causing memory leak)
|
||||||
else if( typeof( MeshFilter ).IsAssignableFrom( currType ) && propertyName == "mesh" )
|
else if( typeof( MeshFilter ).IsAssignableFrom( currType ) && propertyName == "mesh" )
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user