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
1
Question by GurtejKanwar · Aug 01, 2012 at 05:59 PM · androidkillactivityondestroy

Why does onDestroy in UnityPlayerActivity kill the entire process (Android)

I have an Android project which has one Unity activity embedded in it. I'm running into an issue where calling finish() from within this activity causes the entire process to be killed (it sends signal 9 -- SIGKILL). I've managed to pin it down to the call to super.onDestroy() in my Unity activity, which seems to suggest that UnityPlayerActivity kills the entire process in onDestroy(). I have to call through to super.onDestroy(), otherwise Android complains.

Is there a way to avoid this, or a good workaround I can use? Is it possible to override the UnityPlayerActivity onDestroy() function somehow?

Comment
Add comment · Show 1
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 GurtejKanwar · Aug 13, 2012 at 09:51 PM 0
Share

Even more specifically, the signal 9 is co$$anonymous$$g from UnityPlayer.quit(). I've managed to work around this, but it's messing with my Activity stack a lot, so having some sort of cleanup function on UnityPlayer that didn't kill the entire process would be awesome. Does anybody know if there is such a function?

4 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by drdemon · Jul 20, 2013 at 07:48 AM

I was having same problem. I just found a workaround for this. You can start the Unity activties in a different process than the main one in your app. For this you will have to add following in your manifest for all the Unity activities (in my case UnityPlayerProxyActivity, UnityPlayerActivity, UnityPlayerNativeActivity).

android:process=":some_name_for_process"

(observe the ":" in the name. it is required)

Also if you are accessing any shared preferences in unity code, you will have to manipulated them with "MODE_MULTI_PROCESS" mode.

Comment
Add comment · 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
0

Answer by dttngan91 · Feb 22, 2014 at 06:27 AM

After time searching around, I found the solution for avoiding kill process in UnityPlayerActivity when we call finish(); In Activity extends UnityPlayerActivity, you should override onPause method and call super.onDestroy() on it instead of super.onPause(). Have a nice day!

Comment
Add comment · 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
0

Answer by vosnidis · Sep 07, 2017 at 11:07 AM

thanks @drdemon you are a genius

Comment
Add comment · 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
0

Answer by pz_cloud · Feb 15, 2019 at 09:06 AM

So happy to find your answer,definitely solved my problem!!thanks :D @drdemon

Comment
Add comment · 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

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

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Embedding unity into existing android app: UnityPlayer.quit kills app process 0 Answers

Android Unity, Screen Recording and MediaProjection APIs - UnityPlayerActivity hang. 0 Answers

How to open transparent activity from UnityPlayerActivity? 0 Answers

Android - Touch input won't work, Invisible activity in front of Unity activity 0 Answers

How to start the UnityPlayerActivity from a java plugin that overrides the basic Android Activity 1 Answer


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