์•„๊นŒ Json ๊ด€๋ จ ์˜ค๋ฅ˜๋Š” ์–ด์ฐŒ์ €์ฐŒ ํ•ด๊ฒฐ๋ผ์„œ ์œ ๋‹ˆํ‹ฐ ์• ์ฆˆ ํŒŒํŠธ๋กœ ๋„˜์–ด๊ฐ”๋Š”๋ฐ

๊ฐ•์ขŒ๊ฐ€ ์ข€ ์˜ˆ์ „์— ๋งŒ๋“  ๊ฑฐ๋ผ ๊ทธ๋Ÿฐ์ง€ ๋Œ€์‹œ๋ณด๋“œ UI๋‚˜ ์Šคํฌ๋ฆฝํŠธ ์งœ๋Š” ๋ฐฉ์‹์ด ์š”์ฆ˜์ด๋ž‘ ๋‹ค๋ฅธ ๊ฒƒ ๊ฐ™์Œ


๊ฐ•์ขŒ์—์„  ๊ด‘๊ณ  ์Šคํฌ๋ฆฝํŠธ ์งค ๋•Œ ์ฒ˜์Œ์—


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
public class AdController : MonoBehaviour
{
ShowOptions rewardOption;
private void Awake()
{
rewardOption = new ShowOptions { resultCallback = GetReward };
}
// Start is called before the first frame update
void Start()
{
if(Advertisement.isSupported)
{
if(Application.platform == RuntimePlatform.Android)
{
Advertisement.Initialize("์•ˆ๋“œ ID");
}
else if(Application.platform == RuntimePlatform.IPhonePlayer)
{
Advertisement.Initialize("IOS ID");
}
}
else
{
Advertisement.Initialize("์•ˆ๋“œ ID", true);
}
}
private void GetReward(ShowResult result)
{
}
// Update is called once per frame
void Update()
{
}
}
cs
" width='400' height='300' allowScriptAccess='never' >


์ด๋Ÿฐ ์‹์œผ๋กœ ํ–ˆ๋Š”๋ฐ(๋นˆ์นธ์€ ์•„์ง ์ง„ํ–‰ ์ค‘์ด๋ผ ๊ทธ๋Ÿผ)

์ €๊ธฐ Awake์— resultCallback์ด ์ž๋™์™„์„ฑ์— ์•ˆ ๋‚˜์˜ค๋”๋ผ
์•„๋งˆ ์ง€๊ธˆ์€ ์‚ฌ์šฉ ์•ˆ ํ•˜๋Š” ํ‚ค์›Œ๋“œ ๊ฐ™์Œ


resultCallback์„ ๋นผ๋„ ๋˜๋Š” ๊ฑด์ง€ ์•„๋‹ˆ๋ฉด ์ฝ”๋“œ ์ „์ฒด๋ฅผ ์š”์ฆ˜ ์‚ฌ์šฉํ•˜๋Š” ํ˜•ํƒœ๋กœ ๊ฐˆ์•„์—Ž์–ด์•ผ ๋ ์ง€ ๋ชจ๋ฅด๊ฒ ๋Š”๋ฐ ๋„์›€ ์ข€ ๋ถ€ํƒํ•ด์š”