Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Vordas32 · Jan 23, 2015 at 07:03 AM · crashandroidpluginandroid-manifestintegrationandriod

Why my android game crash with chartboost?

Hi,

I'm new to Chartboost and I create my first Test Ad and the ad showing correctly but I have one strange behavior. Let me explaine first my scenes in my game. I create little game for android. It's memory match up game. Scenes are:

1.Main Screen

2.Game Rules

3.Choose Game

4-10. Levels of Game

Test Ad works correctly, it's showing and when I tap on "X" ad is closing so Ad works great but in each of scenes(2-10) when I tap back button on my android device my game is shutting down but it's don't need to be shutting down, its need to load specificly scene in my game. Only when player is on Main Screen and tap back button game must shut down. And without all chartboost stuff(plugin and code) everything works like it's must, like I wanted to work. Test Ad is Static Interstitial and this strange behavior happens every time when Test Ad show(popup). I don't know do I need to put something in my code from chartboost API when another scene is loaded with back button on android device.Or do I need to change something in manifest. Only that I do is follow steps on chartboost website for unity integration and that is I import chartboost plugin, insert APP ID and AP Signature in Chartboost->Edit Settings,put chartboost prefab on my first level Main Screen and call ad in script. I will show you my code so that you can see, maybe I do it something wrong.

Fisrt Level: Main Screen Script (Relevanted)

 using ChartboostSDK;
 
 void Start()
 {   
     Chartboost.showInterstitial (CBLocation.Default);
 }
 
 //When player tap back button on android device
 if (Input.GetKey(KeyCode.Escape))
 {
     //Game is shutting down. Works  OK.
     Application.Quit();
 }

Second Level.Game Rules Script (Relevanted)

 //When player tap back button on android device(But my game is shutting down)
 if (Input.GetKey(KeyCode.Escape))
 {
    //Need to load Main Screen level(But my game is shutting down)
     Application.LoadLevel ("MainScreen");
 }

And on other scenes I have same code to load level in Unity but in all cases when I tap back button on my device to load level that I want(3 times is Main Screen, 1 time is Game Rules and 1 time is Choose Game), level is not load(not showing) instead my game is shutting down.

I was send email to charboost support before 6 hours ago but they did not answer yet. Sory for my english.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by pmaloo · Jan 23, 2015 at 03:31 PM

THe application quits because of the following code in Chartboost.cs:

         void Update() {
             #if UNITY_ANDROID
             // Handle the Android back button (only if impressions are set to not use activities)
             if (Input.GetKeyUp(KeyCode.Escape)) {
                 // Check if Chartboost wants to respond to it
                 if (CBExternal.onBackPressed()) {
                     // If so, return and ignore it
                     Debug.Log("chartboost is closing the visible impression");
 
                     return;
                 } else {
                     Debug.Log("Quit app - chartboost is closing the application");
                     Application.Quit();
                 }
             }
             #endif
         }
 


Delete the ELSE segment and you are good to go. Its weird that this code passed the review with such a glaring mistake. This code causes your application to quit anytime the CB ad is not showing.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Vordas32 · Jan 23, 2015 at 05:01 PM 0
Share

@pmaloo Thanks you very much! I was going crazy. I was not have clue what is going on and why game is shutting down. Thanks a lot! Now is works properly. Thanks again.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

StartApp integration 1 Answer

Using .aar files in unity project and get Failed to re-package resources error 0 Answers

Using CustomUnityPlayerActivity, which inherits from UnityPlayerActivity, will cause problems. 0 Answers

Unity game crash on start on HTC incredible S 2 Answers

Unity 2019.3.5f1 Android Build (IL2CPP) crash Log 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges