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 fusecore · May 19, 2015 at 01:00 PM · pluginwindows phone 8unity analytics

Trouble building with Google Analytics for WP8.1

I'm getting the error "'System.Globalization.CultureInfo' does not contain a definition for 'GetCulture'" when I try to build for WP8.1. My game works fine on Android.

I would also be fine with a method of excluding the entire GA plugin from the WP8.1 build.

Would someone please help?

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
0

Answer by Anders3D · Jan 18, 2016 at 09:06 AM

I got the very similar error CS0117: 'CultureInfo' does not contain a definition for 'GetCultures'. The code causing the problem started at line 65 in the file GoogleAnalyticsV3\GoogleAnalyticsMPV3.cs :

 #if !UNITY_WP8
     CultureInfo[] cultureInfos = CultureInfo.GetCultures(CultureTypes.AllCultures);
     foreach (CultureInfo info in cultureInfos) {
       if (info.EnglishName == Application.systemLanguage.ToString()) {
         language = info.Name;
       }
     }
 #endif

The problem is that you are using the Unity Windows Store .NET scripting backend, which only contains a subset (.NET Core) of the classes in the normal .NET backend used by Unity: http://docs.unity3d.com/Manual/windowsstore-dotnet.html

To remove the problematic piece of code when you are compiling for the Unity Windows Store .NET scripting backend, you can use the preprocessor directive NETFX_CORE which is true in this case. Like so:

 #if !UNITY_WP8 && !NETFX_CORE // .NET Core only contains a subset of all classes.
     CultureInfo[] cultureInfos = CultureInfo.GetCultures(CultureTypes.AllCultures);
     foreach (CultureInfo info in cultureInfos) {
       if (info.EnglishName == Application.systemLanguage.ToString()) {
         language = info.Name;
       }
     }
 #endif

That removes the Google Analytics problems for me.

However, because all your scripts now have to use .NET Core, you may end up running into all sorts of problems with missing classes if you have not compiled the project with that backend before. If you get such problems, an alternative solution is to use the currently (2016-01-15) experimental IL2CPP scripting backend in Unity. For now, it only targets the Windows 10 SDK, but it gives your scripts the same environment as in the Unity editor. Since that process is outside of the scope of your question, I'll just link to a guide on my blog regarding that in case you are interested: http://andersguide.wordpress.com/2016/01/15/how-to-build-and-emulate-for-universal-windows-platform-with-unity-5-3/

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

20 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A first chance exception of type 'System.UnauthorizedAccessException' occurred in System.Windows.ni.dll 0 Answers

How to pass path to plugin? 1 Answer

WindowsPhone plugins 0 Answers

Do google analytics plugin work in webplayer? 1 Answer

Google Analytics For Unity 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