/// <summary>
        /// Find the addressable asset entry for the given asset in these settings.
        /// </summary>
        /// <param name="s">The settings containing the groups for which to fetch the asset entry.</param>
        /// <param name="asset">The asset for which to find the addressable asset entry in the settings.</param>
        /// <returns>The entry in the settings, null otherwise.</returns>
        public static AddressableAssetEntry FindAssetEntry(this AddressableAssetSettings s, UnityEngine.Object asset)
        {
            s.ThrowIfNull(nameof(s));
            asset.ThrowIfNull(nameof(asset));
            string assetGuid = GetAssetGuid(asset);

            if (string.IsNullOrWhiteSpace(assetGuid))
            {
                return(null);
            }

            return(s.FindAssetEntry(assetGuid));
        }
 /// <summary>
 /// Fetches the guid of the asset if it is registered in the AssetDatabase.
 /// </summary>
 /// <param name="asset">The asset for which to fetch the guid.</param>
 /// <returns>The asset's guid if it is found in the asset database, an empty string otherwise.</returns>
 public static string GetAssetGuid(UnityEngine.Object asset)
 {
     asset.ThrowIfNull(nameof(asset));
     return(AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(asset)));
 }
Пример #3
0
 public static void Info(UnityEngine.Object context, string message, object param0, object param1, object param2)
 {
     context.ThrowIfNull(nameof(context));
     UnityEngine.Debug.Log(string.Format(message, param0, param1, param2), context);
 }
Пример #4
0
 /// <summary>
 /// Log an exception to the Unity console.
 /// </summary>
 /// <param name="context">The Unity object context for this exception.</param>
 /// <param name="e">The exception to log.</param>
 // [Conditional("LOG_LEVEL_EXCEPTION"), Conditional("EDITOR_LOG_LEVEL_EXCEPTION")]
 public static void Exception(UnityEngine.Object context, Exception e)
 {
     context.ThrowIfNull(nameof(context));
     UnityEngine.Debug.LogException(e, context);
 }
Пример #5
0
 public static void Error(UnityEngine.Object context, string message, params object[] additionalParams)
 {
     context.ThrowIfNull(nameof(context));
     UnityEngine.Debug.LogError(string.Format(message, additionalParams), context);
 }
Пример #6
0
 public static void Error(UnityEngine.Object context, string message, object param0)
 {
     context.ThrowIfNull(nameof(context));
     UnityEngine.Debug.LogError(string.Format(message, param0), context);
 }
Пример #7
0
 public static void Error(UnityEngine.Object context, string message)
 {
     context.ThrowIfNull(nameof(context));
     UnityEngine.Debug.LogError(message, context);
 }
Пример #8
0
 public static void Warning(UnityEngine.Object context, object message)
 {
     context.ThrowIfNull(nameof(context));
     UnityEngine.Debug.LogWarning(message.ToString(), context);
 }