2024. 7. 11. 07:54, Unity
using System;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
using GoogleMobileAds.Ump.Api;
namespace GoogleMobileAds.Samples
{
/// <summary>
/// Demonstrates how to use the Google Mobile Ads Unity plugin.
/// </summary>
[AddComponentMenu("GoogleMobileAds/Samples/GoogleMobileAdsController")]
public class GoogleMobileAdsController : MonoBehaviour
{
// Always use test ads.
// https://developers.google.com/admob/unity/test-ads
internal static List<string> TestDeviceIds = new List<string>()
{
AdRequest.TestDeviceSimulator,
#if UNITY_IPHONE
"96e23e80653bb28980d3f40beb58915c",
#elif UNITY_ANDROID
"702815ACFC14FF222DA1DC767672A573"
#endif
};
...
위의 코드는 구글애드몹에서 제공해준는 샘플 프로젝트 중에서 GoogleMobileAdsController.cs 의 일부인데,
이때에
[AddComponentMenu("GoogleMobileAds/Samples/GoogleMobileAdsController")]
라는 어트리뷰트가 무슨 기능을 하는지 몰라서 찾아보았다.
해당 어트리뷰트를 클래스 위에 작성하면,
이와같이 Component 에 해당 클래스 파일을 등록해둘 수 있고,
이 메뉴를 통해서 오브젝트에 해당 Component 를 타고 들어가서 원하는 클래스 파일을 선택하면 그 클래스 파일을 오브젝트에 바로 부착할 수 있다.
물론 직접 드래그앤드롭으로 붙일 수 있지만, 이러한 어트리뷰트를 사용하면 클래스의 위치를 직접 알 필요도 없지 깔끔하게 알아서 붙여줄 수 있게 활용할 수 있다.
혹시 다음에 이러한 기능이 필요하면 사용해보도록 하자.
'Unity' 카테고리의 다른 글
developers.google.com 사이트에서 언어 변경시 페이지 로드 불가. (0) | 2024.07.13 |
---|---|
Using "Release" minification (Proguard) in Unity - 이슈정리 (0) | 2024.07.11 |
Google Mobile Ads Unity Plugin Reference. admob api 참조는 이곳에서. (0) | 2024.07.10 |
IDFA 확인을 하는 방법과 이를 이용한 IOS 테스트 기기 등록 (0) | 2024.07.07 |
프로젝트를 빌드하고 난뒤에 Open Editor Log 를 통해서 확인하는 Build Report (0) | 2024.06.18 |
Comments, Trackbacks