- Buat gameobject, beri nama StartAppObject
- Add Component script pada StartAppObject, lalu scriptnya beri nama MyStartAppBehaviour, isi scriptnya sebagai berikut:
1: using UnityEngine; 2: using System.Collections; 3: using StartApp; 4: public class MyStartAppBehaviour : MonoBehaviour { 5: public void RequestStartApp(){ 6: #if UNITY_ANDROID 7: StartAppWrapper.loadAd(); 8: #endif 9: } 10: public void ShowStartApp(){ 11: #if UNITY_ANDROID 12: StartAppWrapper.showAd(); 13: StartAppWrapper.loadAd(); 14: #endif 15: } 16: }
- Jangan lupa, untuk menampilkan iklan StartApp, harus panggil fungsi Requestnya "RequestStartApp()", cukup sekali aja. Bisa diletakkan di "Start", baru setelah itu panggil fungsi "ShowStartApp()" untuk menampilkan iklannya.
- Script untuk memanggil fungsi "RequestStartApp()" di script lain (beda kelas) :
GameObject.Find ("StartAppObject").GetComponent<MyStartAppBehaviour>().RequestStartApp();
- Script untuk memanggil fungsi "ShowStartApp()" di script lain (beda kelas) :
GameObject.Find ("StartAppObject").GetComponent<MyStartAppBehaviour>().ShowStartApp();
- Cek file manifest android, jangan lupa tambahkan activitynya didalam elemen <application>:
1: <activity android:name="com.startapp.android.publish.list3d.List3DActivity" 2: android:hardwareAccelerated="true" 3: android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/> 4: <activity android:name="com.startapp.android.publish.AppWallActivity" 5: android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" 6: android:hardwareAccelerated="true" 7: android:configChanges="orientation|keyboardHidden|screenSize" />
- Cek file "StartAppData.txt", isi developerid dan applicationid
- Contoh simpelnya :
1: using UnityEngine; 2: using System.Collections; 3: using UnityEngine.UI; 4: public class CounterBehaviour : MonoBehaviour { 5: int counter; 6: public Text textCounter; 7: // Use this for initialization 8: void Start () { 9: counter = 0; 10: textCounter.text = "Let's Count"; 11: GameObject.Find ("StartAppObject").GetComponent<MyStartAppBehaviour>().RequestStartApp(); 12: } 13: // Update is called once per frame 14: void Update () { 15: Debug.Log (" ++++++++++++++++++ " + counter); 16: for (var i = 0; i < Input.touchCount; ++i) { 17: if (Input.GetTouch(i).phase == TouchPhase.Began){ 18: counter++; 19: textCounter.text=counter.ToString(); 20: if(counter%2==0){ 21: GameObject.Find ("StartAppObject").GetComponent<MyStartAppBehaviour>().ShowStartApp(); 22: } 23: } 24: } 25: } 26: }
Sunday, 17 May 2015
Contoh Simpel Mengintegrasikan StartApp dengan Unity Game
Subscribe to:
Post Comments
(
Atom
)
2 comments :
bisa ajari tutorial startaap dari awal hingga akhir
Hi Zaki :)
Coba ikuti :
1. http://catatankoding-ismyself.blogspot.co.id/2015/05/mendaftarkan-aplikasi-ke-startapp.html
2. http://catatankoding-ismyself.blogspot.co.id/2015/05/contoh-simpel-mengintegrasikan-startapp.html?showComment=1447505176698#c1920599020409578763
Kalo belum mengerti silahkan tanya aja lagi :D
Post a Comment