• 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 FuelDev · Aug 25, 2016 at 11:44 AM · androidpluginpluginsmanifestmetadata

AndroidManifest.xml: meta-data unityplayer.UnityActivity

I've been recently looking at some sample AndroidManifest.xml files for several Unity projects and periodically, some projects have a main app Activity with the following meta-data tag:

<meta-data android:name="unityplayer.UnityActivity" android:value="true" />

Does anyone know what purpose adding that particular meta-data tag does?

Not all sample projects that I've seen have that and the Unity Android plugin documentation makes no reference to it. I haven't been able to find any explanation for it anywhere in my searches online. It just seems to appear. Any ideas? Hoping someone from Unity can chime in :)

Update (2016/08/25): I've done a bit of investigating and it seems to have made it's appearance in the default generated AndroidManifest.xml since Unity 4.3.3f1. By setting the value to "true" it appears to impose a fixed set of attributes/values on the main Activity tag. If the value is "false", or the meta-data tag doesn't exist in the AndroidManifest.xml, then the main Activity tag is left unmodified from the result of merging of the manifest files found within the Assets/Plugins/Android/ folder. This would suggest that it's a toggle for ensuring the necessary attributes are used when a Unity-based Activity (UnityPlayerActivity, UnityPlayerNativeActivity, UnityPlayerProxyActivity) -- not a subclass of one -- is set as the main application Activity. I'm just guessing, of course.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by canyon_gyh · Sep 30, 2018 at 06:56 AM

I guess that control UnityPlayer or UnityPlayer's Child , UnityPlayer can control Android Fragment is closely related

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 julian_cruz · Oct 24, 2018 at 02:45 PM

What it does, it's select the activity to be patched with the following properties.

 android:screenOrientation="fullSensor" android:launchMode="singleTask" 
 android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" 
 android:hardwareAccelerated="false"

if none activities have this property, the following filter will be by the activity name, trying to find the following matches.

 "com.unity3d.player.UnityPlayerNativeActivity",
 "com.unity3d.player.UnityPlayerActivity",
 "com.unity3d.player.UnityPlayerProxyActivity"

In case of these statements are false, a warning will be thrown with this message with the specific properties required. "Unable to find unity activity in manifest. You need to make sure orientation attribute is set to {0} manually."

keep in mind that you can set the properties manually.

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 MechEthan · Sep 05, 2019 at 05:57 PM 0
Share

It's important to note that the patched values are dependent on your Android Player Settings -- for example, it patches in android:screenOrientation="fullSensor" if the Player Setting "Default Orientation" is set to "Auto Rotation", but if you set it to "Portrait" then Unity will patch the activity to have: android:screenOrientation="portrait"

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

6 People are following this question.

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

Related Questions

UnityPlayerActivity vs. UnityPlayerNativeActivity 0 Answers

Change an Android app's manifest by putting manifest.xml in Plugins/Android folder? 2 Answers

Android app may work in BG with Plugin? 1 Answer

PLease help: android plugins manifest woes 2 Answers

Android Activity equal in ios 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges