File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 11using System ;
22using System . Reflection ;
33using UnityEditor ;
4+ using UnityEngine ;
45using Object = UnityEngine . Object ;
56
67namespace StansAssets . Foundation . Editor
@@ -23,8 +24,19 @@ public static int GetLocalIdentifierInFile(Object unityObject)
2324
2425 var serializedObject = new SerializedObject ( unityObject ) ;
2526 inspectorModeInfo . SetValue ( serializedObject , InspectorMode . Debug , null ) ;
26- var localIdProp = serializedObject . FindProperty ( "m_LocalIdentfierInFile" ) ; //note the misspelling!
27+ var localIdProp = serializedObject . FindProperty ( "m_LocalIdentfierInFile" ) ; //note the misspelling!
2728 return localIdProp . intValue ;
2829 }
30+
31+ /// <summary>
32+ /// Returns the absolute path name for the asset.
33+ /// </summary>
34+ /// <param name="asset">A reference to the asset.</param>
35+ /// <returns>The asset path name, or null, or an empty string if the asset does not exist.</returns>
36+ public static string GetAssetAbsolutePath ( Object asset )
37+ {
38+ var absoluteFilePath = Application . dataPath . Substring ( 0 , Application . dataPath . Length - 7 ) ;
39+ return $ "{ absoluteFilePath } /{ AssetDatabase . GetAssetPath ( asset ) } ";
40+ }
2941 }
30- }
42+ }
You can’t perform that action at this time.
0 commit comments