예제 #1
0
 public static T GetComponent <T>(
     this IAddressablesLoader <GameObject> addressablesLoader,
     AssetReferenceComponent <T> assetReference)
     where T : Component
 {
     return(addressablesLoader.GetAsset(assetReference).GetComponent <T>());
 }
예제 #2
0
        public static bool TryGetComponent <T>(
            this IAddressablesLoader <GameObject> addressablesLoader,
            AssetReferenceComponent <T> assetReference, out T component)
            where T : Component
        {
            if (addressablesLoader.TryGetAsset(assetReference, out var gameObject))
            {
                return(gameObject.TryGetComponent(out component));
            }

            component = default;
            return(false);
        }