'Unity3D' 카테고리의 다른 글
터치한 지점으로 이동하기 (0) | 2016.08.25 |
---|---|
4.6 터치 이벤트 (0) | 2015.09.10 |
Unity Sprite Zorder (0) | 2015.09.10 |
유니티 애즈 연동 (4) | 2015.06.26 |
Admob 연동 방법 (0) | 2015.06.26 |
터치한 지점으로 이동하기 (0) | 2016.08.25 |
---|---|
4.6 터치 이벤트 (0) | 2015.09.10 |
Unity Sprite Zorder (0) | 2015.09.10 |
유니티 애즈 연동 (4) | 2015.06.26 |
Admob 연동 방법 (0) | 2015.06.26 |
출처 : http://cafe.naver.com/unityhub
유니티 인스펙터 순서대로 sort 방법 (0) | 2016.08.25 |
---|---|
4.6 터치 이벤트 (0) | 2015.09.10 |
Unity Sprite Zorder (0) | 2015.09.10 |
유니티 애즈 연동 (4) | 2015.06.26 |
Admob 연동 방법 (0) | 2015.06.26 |
public class TestScript : MonoBehaviour, IPointerDownHandler, IPointerEnterHandler {
// 인터페이스 트리거 관련
public void OnPointerDown(PointerEventData data)
{
Debug.Log(transform.name);
}
public void OnPointerEnter(PointerEventData data)
{
Debug.Log("MouseOver");
}
}
유니티 인스펙터 순서대로 sort 방법 (0) | 2016.08.25 |
---|---|
터치한 지점으로 이동하기 (0) | 2016.08.25 |
Unity Sprite Zorder (0) | 2015.09.10 |
유니티 애즈 연동 (4) | 2015.06.26 |
Admob 연동 방법 (0) | 2015.06.26 |
SpriteRenderer에서 Order in Layer 를 조절하면 된다.
터치한 지점으로 이동하기 (0) | 2016.08.25 |
---|---|
4.6 터치 이벤트 (0) | 2015.09.10 |
유니티 애즈 연동 (4) | 2015.06.26 |
Admob 연동 방법 (0) | 2015.06.26 |
Unity3D Android JNI 연동 (0) | 2015.06.26 |
http://www.unityads.co.kr/?page_id=518 에서
웹 설정 다해주고
github에 있는
UnityAdsHelper.cs
using UnityEngine;
using System.Collections;
// UnityAdsHelper.cs - Written for Unity Ads Asset Store v1.0.4 (SDK 1.3.10)
// by Nikkolai Davenport <nikkolai@unity3d.com>
//
// Setup Instructions:
// 1. Attach this script to a new game object.
// 2. Enter game IDs into the fields provided.
// 3. Enable Development Build in Build Settings to
// enable test mode and show SDK debug levels.
//
// Usage Guide:
// Write a script and call UnityAdsHelper.ShowAd() to show an ad.
// Customize the HandleShowResults method to perform actions based
// on whether an ad was succesfully shown or not.
//
// Notes:
// - Game IDs by platform are required to initialize Unity Ads.
// - Test game IDs are optional. If not set while in test mode,
// test game IDs will default to platform game IDs.
// - The various debug levels and test mode are only used when
// Development Build is enabled in Build Settings.
// - Test mode can be disabled while Development Build is set
// by checking the option to disable it in the inspector.
using UnityEngine;
using System.Collections;
#if UNITY_IOS || UNITY_ANDROID
using UnityEngine.Advertisements;
#endif
public class UnityAdsHelper : MonoBehaviour
{
[System.Serializable]
public struct GameInfo
{
[SerializeField]
private string _gameID;
[SerializeField]
private string _testGameID;
public string GetGameID()
{
return Debug.isDebugBuild && !string.IsNullOrEmpty(_testGameID) ? _testGameID : _gameID;
}
}
public GameInfo iOS;
public GameInfo android;
// Development Build must be enabled in Build Settings
// in order to use test mode and to show debug levels.
public bool disableTestMode;
public bool showInfoLogs;
public bool showDebugLogs;
public bool showWarningLogs = true;
public bool showErrorLogs = true;
protected void Awake()
{
#if UNITY_IOS || UNITY_ANDROID
string gameID = null;
#if UNITY_IOS
gameID = iOS.GetGameID();
#elif UNITY_ANDROID
gameID = android.GetGameID();
#endif
if (string.IsNullOrEmpty(gameID))
{
Debug.LogError("A valid game ID is required to initialize Unity Ads.");
}
else
{
Advertisement.debugLevel = Advertisement.DebugLevel.NONE;
if (showInfoLogs) Advertisement.debugLevel |= Advertisement.DebugLevel.INFO;
if (showDebugLogs) Advertisement.debugLevel |= Advertisement.DebugLevel.DEBUG;
if (showWarningLogs) Advertisement.debugLevel |= Advertisement.DebugLevel.WARNING;
if (showErrorLogs) Advertisement.debugLevel |= Advertisement.DebugLevel.ERROR;
bool enableTestMode = Debug.isDebugBuild && !disableTestMode;
Debug.Log(string.Format("Initializing Unity Ads for game ID {0} with test mode {1}...",
gameID, enableTestMode ? "enabled" : "disabled"));
Advertisement.Initialize(gameID, enableTestMode);
}
#else
Debug.LogWarning("Unity Ads is not supported on the current build platform.");
#endif
}
public static bool isInitialized
{
get
{
#if UNITY_IOS || UNITY_ANDROID
return Advertisement.isInitialized;
#else
return false;
#endif
}
}
public static bool isReady(string zone = null)
{
#if UNITY_IOS || UNITY_ANDROID
if (string.IsNullOrEmpty(zone)) zone = null;
return Advertisement.isReady(zone);
#else
return false;
#endif
}
public static bool ShowAd(string zone = null, bool pauseGameDuringAd = true)
{
#if UNITY_IOS || UNITY_ANDROID
if (string.IsNullOrEmpty(zone)) zone = null;
if (!Advertisement.isReady(zone))
{
Debug.LogWarning(string.Format("Unable to show ad. The ad placement zone ($0) is not ready.",
zone == null ? "default" : zone));
return false;
}
ShowOptions options = new ShowOptions();
options.pause = pauseGameDuringAd;
options.resultCallback = HandleShowResult;
Advertisement.Show(zone, options);
return true;
#else
Debug.LogError("Failed to show ad. Unity Ads is not supported on the current build platform.");
return false;
#endif
}
#if UNITY_IOS || UNITY_ANDROID
private static void HandleShowResult(ShowResult result)
{
switch (result)
{
case ShowResult.Finished:
Debug.Log("The ad was successfully shown.");
break;
case ShowResult.Skipped:
Debug.Log("The ad was skipped before reaching the end.");
break;
case ShowResult.Failed:
Debug.LogError("The ad failed to be shown.");
break;
}
}
#endif
public void ShowTestAds()
{
ShowAd();
}
}
스크립트 생성.
ShowAd() 호출하면
동영상 광고가 나옴
4.6 터치 이벤트 (0) | 2015.09.10 |
---|---|
Unity Sprite Zorder (0) | 2015.09.10 |
Admob 연동 방법 (0) | 2015.06.26 |
Unity3D Android JNI 연동 (0) | 2015.06.26 |
NGUI sprite 텍스쳐 변경 (0) | 2015.05.14 |
Unity Sprite Zorder (0) | 2015.09.10 |
---|---|
유니티 애즈 연동 (4) | 2015.06.26 |
Unity3D Android JNI 연동 (0) | 2015.06.26 |
NGUI sprite 텍스쳐 변경 (0) | 2015.05.14 |
외부 script 접근 방법 (0) | 2015.05.14 |
C#
public class TestMethod : MonoBehaviour {
// Use this for initialization
void Start () {
using (AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
{
using( AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject>("currentActivity"))
{
jo.Call("initActivity", "unity to android");
}
}
}
public void AndroidLog( string a )
{
transform.GetComponent<GUIText>().text = a;
}
// Update is called once per frame
void Update () {
}
}
유니티 애즈 연동 (4) | 2015.06.26 |
---|---|
Admob 연동 방법 (0) | 2015.06.26 |
NGUI sprite 텍스쳐 변경 (0) | 2015.05.14 |
외부 script 접근 방법 (0) | 2015.05.14 |
유니티 싱글톤. (0) | 2015.05.13 |
this.GetComponent<UISprite> ().spriteName = texture;
Admob 연동 방법 (0) | 2015.06.26 |
---|---|
Unity3D Android JNI 연동 (0) | 2015.06.26 |
외부 script 접근 방법 (0) | 2015.05.14 |
유니티 싱글톤. (0) | 2015.05.13 |
NGUI sprite 마우스 입력 (0) | 2015.05.13 |
1. public List<Hole> HoleList; 선언
2. 에디터에서 게임 오브젝트( Hole )를 끌어서 List에 추가
Unity3D Android JNI 연동 (0) | 2015.06.26 |
---|---|
NGUI sprite 텍스쳐 변경 (0) | 2015.05.14 |
유니티 싱글톤. (0) | 2015.05.13 |
NGUI sprite 마우스 입력 (0) | 2015.05.13 |
Error building Player: Win32Exception: ApplicationName='~ 안드로이드 빌드 오류 해결방법 (0) | 2015.05.13 |
NGUI sprite 텍스쳐 변경 (0) | 2015.05.14 |
---|---|
외부 script 접근 방법 (0) | 2015.05.14 |
NGUI sprite 마우스 입력 (0) | 2015.05.13 |
Error building Player: Win32Exception: ApplicationName='~ 안드로이드 빌드 오류 해결방법 (0) | 2015.05.13 |
sprite 텍스쳐 변경 (0) | 2015.05.05 |