Get it on Google Play


Wm뮤 :: 'Unity' 카테고리의 글 목록 (3 Page)

블로그 이미지
불펌때문에 드래그 방지 건것가지고
99% 다 공유되는 지식 가져와서 쓰는 글 아니냐 누가 보면 자기 지식 훔쳐가는줄 자기도 다 베껴온거일텐데
같은 소리 할거면 꾸역꾸역 블로그 찾아오지 말고 AI나 쓰쇼.
세상에 없는게 많아서 제로베이스에서 손수 연구하고 만들어서 정리해줬더니 이런 소리나 들어야 합니까?
모카쨩
@ahzkwid

Recent Comment

Archive


2023. 11. 21. 01:28

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

2023. 11. 15. 16:11

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

2023. 10. 14. 12:29

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

2023. 9. 24. 06:35 Unity

 

 

 

https://wmmu.tistory.com/entry/FireBase-%EC%95%A0%EB%93%9C%EB%AA%B9

 

유니티 애드몹 2021

얘내들은 툭하면 API를 바꾼다. 개빡칠노릇 설명서 developers.google.com/admob/unity/quick-start?hl=ko 해당링크에서 들어가보면 이런걸 다운받아서 쓰라고 한다 github.com/googleads/googleads-mobile-unity/releases/tag/v5

wmmu.tistory.com

 

 

진짜 미쿠친구들인가?

또또또 API 바꿨다

기능차이도 없던데 대체 왜 바꾼거임?

일단 대략적인건 위 링크이고

이번엔 기존에 있던 플러그인을 업뎃하는 작업만 해서

신규프로젝트에서 작업하면 뭔가 새로운 창이 뜰지도 모른다

 

 

 

설명서

https://developers.google.com/admob/unity/quick-start?hl=ko 

 

해당링크에서 플러그인 다운로드 링크 누르면 뭐 가입하라고 궁시렁 대는데

https://github.com/googleads/googleads-mobile-unity/releases/tag/v8.5.2

걍 여기서 유니티 패키지를 다운받아서 푼다

 

 

저기엔 안 써있는데 2020.3.48f1이 아니면 오류폭탄이 날아온다

버전이 낮아도 안되고 높아도 안 된다

2021.1.10f1까지는 작동은 되더라

2019.4.31f1은 미지원이다

 

 

 

일단 업뎃과정에서 플러그인 싹 지우고 넣었기 때문에 세팅이 날아가서 다시 설정해줌

그래도 이번엔 뭐 이상한 창 안떠서 다행이네

 

누르고 생기는 스크립트오브젝트에 애드몹 코드를 입력한다

없으면 하단의 샘플코드를 넣는다

ca-app-pub-3940256099942544~1033173712

키가 이상하면 강종당하니 조심하자

 

 

 

https://apps.admob.com/

애드몹 코드는 애드몹사이트에서

 

여기에 숨겨져있다 ~가 들어간 코드여야 한다

 

전면광고방법

https://developers.google.com/admob/unity/interstitial?hl=ko 

 

 

코드가 많이 바뀌었다

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
public class AdMobLoader : MonoBehaviour
{
#if UNITY_ANDROID
    string adUnitId = "ca-app-pub-3940256099942544/1033173712";
#elif UNITY_IOS
        string adUnitId = "ca-app-pub-3940256099942544/4411468910";
#else
        string adUnitId = "unexpected_platform";
#endif

    public void Start()
    {
        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(initStatus => { });

        RequestInterstitial();

    }

    public void Update()
    {
    }


    private InterstitialAd interstitialAd;

    private void RequestInterstitial()
    {
        // create our request used to load the ad.
        var adRequest = new AdRequest();

        // send the request to load the ad.
        InterstitialAd.Load(adUnitId, adRequest,
            (InterstitialAd ad, LoadAdError error) =>
            {
                // if error is not null, the load request failed.
                if (error != null || ad == null)
                {
                    Debug.LogError("interstitial ad failed to load an ad " +
                                   "with error : " + error);
                    return;
                }

                Debug.Log("Interstitial ad loaded with response : "
                          + ad.GetResponseInfo());

                interstitialAd = ad;

                //로드끝나면 5초뒤 광고표시
                Invoke(nameof(ShowInterstitial), timer);
            });
    }
    public float timer = 5f;
    void ShowInterstitial()
    {
        Debug.Log("광고가 표시됨");
        //if (interstitialAd.CanShowAd())
        {
            interstitialAd.Show();
        }
    }

    private void InterstitialDestroy()
    {
        interstitialAd.Destroy();
    }
}

기본 샘플코드를 이용하여 만들어봤다

이번에 개많이 바뀌어서 개고생함

이러고 또 나중에 바뀌겠지 ㅡㅡ

 

 

 

위 코드에 들어가는 키위치는 여기고 /가 들어간 코드여야 한다

 

 

 

필수적인 작업은 다 끝났다

이제 부가작업

이거 넣어줘야 에디터에서 안드로이드모드로 재생해도 오류가 안 뜬다

 

 

 

 

 

 

 

 

 

'Unity' 카테고리의 다른 글

unity mmd 관련  (0) 2023.10.01
유니티 캐릭터 추적 마커  (0) 2023.09.21
유니티 APK 용량  (0) 2023.09.08
posted by 모카쨩
2023. 9. 21. 03:08 Unity

 

https://gist.github.com/ahzkwid/c052100046bf673d5aca0801fcbcf036


    public GameObject playerIcon;
     List<GameObject> playerIcons = new List<GameObject>();
    void Start()
    {
        playerIcon.SetActive(false);
    }
    void LateUpdate()
    {
        var gameSystem = GetComponent<GameSystem>();
        {
            //아군 식별 마커
            var characters = GameSystem.GetInGameCharacters(gameSystem.team);
            for (int i = playerIcons.Count; i < characters.Length; i++)
            {
                var instant = Instantiate(playerIcon, playerIcon.transform.parent);
                playerIcons.Add(instant);
            }
            for (int i = characters.Length; i < playerIcons.Count; i++)
            {
                playerIcons[i].SetActive(false);
            }
            var cam = Camera.main;
            for (int i = 0; i < characters.Length; i++)
            {
                var markerPosition = characters[i].transform.position + Vector3.up * 1f;
                if ((Vector3.Distance(markerPosition, cam.transform.position) > 10)
                    && (Quaternion.Angle(cam.transform.rotation, Quaternion.LookRotation(markerPosition - cam.transform.position)) < 90))
                {
                    var screenPoint = RectTransformUtility.WorldToScreenPoint(cam, markerPosition);
                    playerIcons[i].SetActive(true);
                    playerIcons[i].GetComponent<RectTransform>().position = screenPoint;
                }
                else
                {
                    playerIcons[i].SetActive(false);
                }
            }
        }
    }

 

웨이포인트 같은거 표시할때도 씀

'Unity' 카테고리의 다른 글

유니티 애드몹 2023  (0) 2023.09.24
유니티 APK 용량  (0) 2023.09.08
유니티 킬로그  (0) 2023.08.28
posted by 모카쨩
2023. 9. 9. 19:09

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.

2023. 9. 8. 14:55

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.