Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
1
Question by SoylentGraham · Aug 28, 2015 at 01:02 PM · il2cppmono

How do I check for the IL2CPP scripting backend/setting?

With my plugin, I have a couple of problems with [marshalling in] mono. These problems are okay in IL2CPP, (which is required anyway for ios now)

Can I check to make sure IL2CPP is set and throw, or print errors, or even better, compile-time errors if IL2PP is not selected?

Comment
Add comment · Show 2
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 Dave-Carlile · Aug 28, 2015 at 01:08 PM 0
Share

Not completely sure what you're asking - do you mean during build time make sure it's using IL2CPP? If so then you might be able to create a custom build script that forces the options you want...

avatar image Dave-Carlile · Aug 28, 2015 at 01:10 PM 1
Share

And... http://answers.unity3d.com/questions/892370/where-can-i-use-scriptingimplementation.html

Or... http://forum.unity3d.com/threads/buildpipeline-il2cpp-universal-architecture.301948/

$$anonymous$$ight be able to do something with that?

3 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by SoylentGraham · Aug 28, 2015 at 01:21 PM

Thanks to Dave Carlile and Graham, the king of unity support in the linked answer. (Obviously I'll have a better error message)

 #if UNITY_EDITOR
         UnityEditor.ScriptingImplementation backend = (UnityEditor.ScriptingImplementation)UnityEditor.PlayerSettings.GetPropertyInt("ScriptingBackend", UnityEditor.BuildTargetGroup.iOS);
         if (backend != UnityEditor.ScriptingImplementation.IL2CPP) {
             Debug.LogError ("Warning: If the scripting backend is not IL2CPP there may be problems");
         }
 #endif

Would be interested to know if anyone has any compile-time solutions, but an error when running in the editor is good enough for now :)

Comment
Add comment · Show 3 · 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 Dave-Carlile · Aug 28, 2015 at 01:26 PM 0
Share

I do the custom build script - it creates a build menu for me and I do my builds with that. You can force all of the options you want, have different menu items for different types of builds, etc. You could do the SetPropertyInt to set the scripting implementation then call the build function. It can take a bit to set up, but it's pretty handy once it's working.

avatar image SoylentGraham · Aug 28, 2015 at 03:14 PM 0
Share

I don't really want to force build scripts or secretly change build settings on people for a plugin :/

avatar image Dave-Carlile · Aug 28, 2015 at 03:37 PM 0
Share

Ah, yep, makes sense. Didn't know it was something that would end up out of your control. If your plugin has an editor interface it should be possible to display a message there as well.

avatar image
2

Answer by codestage · May 11, 2019 at 10:43 PM

Here is a super simple way to check from the Editor code if current build settings have IL2CPP selected as a scripting backend:

 public static bool IsIL2CPPEnabled()
 {
     return PlayerSettings.GetScriptingBackend(EditorUserBuildSettings.selectedBuildTargetGroup) == ScriptingImplementation.IL2CPP;
 }



Note, you can also set it in similar way, if target platform supports IL2CPP:

 PlayerSettings.SetScriptingBackend(EditorUserBuildSettings.selectedBuildTargetGroup, ScriptingImplementation.IL2CPP); 



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 ksg97031 · Apr 14, 2017 at 01:31 AM

It's new, support new version higher then 5.6

Android PlayerSettings.GetScriptingBackend(UnityEditor.BuildTargetGroup.Android);

IOS PlayerSettings.GetScriptingBackend(UnityEditor.BuildTargetGroup.iOS);

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

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

Related Questions

A simple 2D unity game facing Jerks/Lags 0 Answers

Drastically worse performance with IL2CPP compared to Mono on Android 1 Answer

Reading XML on Mono Fails - IL2CPP works?! 0 Answers

/SOLVED /il2cpp makes my app crash 0 Answers

How to fix apps containing an unsafe implementation of TrustManager 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