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 Terrance · Dec 28, 2010 at 06:41 PM · androidcamerapluginmapactivity

UnityPlayer in an Android MapActivity

Hello UnityAnswers!

I'm building an Android app with Unity and a custom Activity. This Activity is already working well with a UnityPlayer and a CameraPreview. (The CameraPreview extends SurfaceView and implements SurfaceHolder.Callback and Camera.PreviewCallback to draw the camera view behind Unity.)

Now I want to do something similar with a MapView behind Unity. According to the Android docs, "A MapView can only be constructed (or inflated) by a MapActivity," so my plugin Activity is now a MapActivity. The trick here appears to be that the Activity's MapView must be an android.maps.MapView, so it can't also be a SurfaceView.

My question is, how can I get the effect of having Unity "punch through" the MapView as it does with the CameraPreview, while I can't make the MapView a SurfaceView as I have done with the CameraPreview? If the same technique can't be applied for a MapView, then is there some way to "scrape" the MapView and draw it onto a Plane in Unity?

Thank you in advance for any assistance!

Terrance Cohen, Ogmento, Inc.

Here's a bit of code for reference:

public class MyActivity extends MapActivity implements VideoUser { private CameraPreview cameraPreview; private UnityPlayer unityPlayer; MapView mapView; ...

class CameraPreview extends SurfaceView implements SurfaceHolder.Callback, Camera.PreviewCallback { SurfaceHolder surfaceHolder; Camera camera; VideoUser videoUser; ...

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Greg 10 · Feb 28, 2011 at 04:28 PM

Hello,

I hope that you get your answer now. Sadly i have no tips to help you, however, i am really interested in the way you managed to get the android camera working behind the unity player. i'm trying to do the same thing, and the only thing i got is the camera working in the unityPlayerActivity, but the rest of my unity project is stop.

Can you please tell me how to get it work.

Thank You Greg

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 lbalasubbaiahapps · Oct 21, 2011 at 08:17 AM 0
Share

hi friends once you search QcarCom it is free plugin for ios/android also . if you need you will get on asset store in free . it will help to your camera directly.

avatar image
0

Answer by PaulaCL · Oct 14, 2011 at 08:34 AM

Hi Terrance! I'm trying to develop an Android app displaying the camera at the background and a 3d model with unity on top of that camera but i'm new with unity and i can't find any examples well documented. I read your post that you have successfully achieved something similar (I understand camera preview and implementing surface.callback etc...) but I don't know how to merge it with a unity app. Can you give me a piece of advice or a bit of code. Any help would be appreciated.

Thanks! Paula ;-)

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 PaulaCL · Oct 14, 2011 at 08:34 AM

Hi Terrance! I'm trying to develop an Android app displaying the camera at the background and a 3d model with unity on top of that camera but i'm new with unity and i can't find any examples well documented. I read your post that you have successfully achieved something similar (I understand camera preview and implementing surface.callback etc...) but I don't know how to merge it with a unity app. Can you give me a piece of advice or a bit of code. Any help would be appreciated.

Thanks! Paula ;-)

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

2 People are following this question.

avatar image avatar image

Related Questions

show Alertdialog in android 0 Answers

How can I replace correctly the main activity on the Android Manifest? 0 Answers

Android plugin & Activity help needed - "GetMethodID method not found" problems 0 Answers

android: why scene goes black when showing new activity? 3 Answers

Android - Touch input won't work, Invisible activity in front of Unity activity 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