Пример #1
0
        /// <summary>
        /// Returns the last modified time for the given asset.
        /// </summary>
        static public long GetAssetModifyTimestamp(UnityEngine.Object inObject)
        {
            #if UNITY_EDITOR
            if (inObject.IsReferenceNull())
            {
                return(0);
            }

            string assetPath = AssetDatabase.GetAssetPath(inObject);
            return(GetFileModifyTimestamp(assetPath));
            #else
            return(0);
            #endif // UNITY_EDITOR
        }
Пример #2
0
        /// <summary>
        /// Returns an identifier for the given asset.
        /// </summary>
        static public StringHash32 GetAssetIdentifier(UnityEngine.Object inObject)
        {
            if (inObject.IsReferenceNull())
            {
                return(StringHash32.Null);
            }

            #if UNITY_EDITOR
            string assetPath = AssetDatabase.GetAssetPath(inObject);
            if (AssetDatabase.IsMainAsset(inObject))
            {
                return(string.Format("{0}::{1}", inObject.GetType().Name, assetPath));
            }

            return(string.Format("{0}::{1}->{2}", inObject.GetType().Name, assetPath, inObject.name));
            #else
            return(string.Format("{0}::{1}({2})", inObject.GetType().Name, inObject.name, inObject.GetInstanceID()));
            #endif // UNITY_EDITOR
        }