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
3
Question by yyy450 · Nov 30, 2009 at 08:49 AM · pluginpro-only

Can I use the c++ plugin for the browser-based game?

I have my librarys built in c++ such as AI, and want to use them in my browser-based game. But I notice the information in the document:

Unity Manual > Advanced > Plugins - Pro only feature

Unity has extensive support for C, C++ or Objective-C based Plugins. Plugins will work in standalones only. They are disabled when building a Web Player for security reasons.

Is it means that Plugins cann't be used in the browser-based game? Thanks!

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
7
Best Answer

Answer by jonas-echterhoff · Nov 30, 2009 at 09:15 AM

Yes, you cannot use C++ plugins in browser based games. Allowing this would mean people could execute arbitrary C++ code on any user's machine, which would be a very big security hole. You can you managed C# dlls in the web plugin, though.

Comment
Add comment · Show 5 · 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 yyy450 · Nov 30, 2009 at 09:37 AM 0
Share

Thanks! Can you tell me the detail about the security? I can not understand it.

avatar image jonas-echterhoff ♦♦ · Nov 30, 2009 at 11:11 AM 0
Share

See Jashan's comment below. Basically, giving developers access to C++ code, would allow making a malicious web site, which can access/delete files on the user's hard disk, crash the browser, access other connected hardware, just by having the user visit the web site. That is not acceptable.

avatar image yyy450 · Dec 01, 2009 at 01:25 AM 0
Share

Thanks very much for your answer!

avatar image cowlinator · Jun 10, 2015 at 08:49 PM 0
Share

Is this still true of WebGL?

avatar image Bunny83 · Jun 10, 2015 at 09:05 PM 0
Share

@cowlinator:
A webGL build is even more restricted as you can only use interfaces which has been made available and everything that might be a security problem is not allowed. The UnityWebplayer allows slighly more things as the webplayer itself is a native plugin. So the webplayer plugin itself could execute any code on the client but it has been developed by a trusted company. Content that is viewed with the webplayer is something that is generally not trusted.

Here you see a list of things that are not supported when targetting webGL.

avatar image
4

Answer by jashan · Nov 30, 2009 at 10:00 AM

The problem with security would be that a malicious developer could basically develop a virus and spread it as a Web player, if he had access to C++ plugins from the Web player. With the integrated Mono-framework used for scripting, anything that could be harmful to the enduser's machine can comparatively easily be prevented ("sandbox"). Doing that for C++ plugins would be extremely hard (if not impossible), and it would take away the most important thing C++ plugins are used for: accessing hardware that isn't otherwise accessible.

You have one alternative, though: There's also a .NET-version of C++. Maybe you can compile your libraries to .NET assemblies and use them from within your game (that's possible with Web players).

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 Ashkan_gc · Nov 30, 2009 at 05:27 PM 0
Share

dear jashan! you always answer questions as well as possible you can not use C++/CLI on $$anonymous$$ONO. you can use it on mono for windows but it will not work on macs because it's mix mode assembly and (native code and CIL) it's possible to generate CIL only assemblies but it's too hard to do so. see faq http://www.mono-project.com/FAQ:_Technical mono-c++ http://www.mono-project.com/CPlusPlus there is an exe file in .NET SD$$anonymous$$ that tells you if the code is managed only or not. also you should use /slr:pure or /clr:safe flags to generate pure managed codes.

avatar image yyy450 · Dec 01, 2009 at 01:28 AM 0
Share

Thanks! I will try to use C# or .NET-version of C++.Is it only allowed in the pro version of unity?

avatar image jashan · Dec 01, 2009 at 02:59 PM 0
Share

As long as you have .NET assemblies, you do not need to Pro version of Unity. However, if I understand Ashkan correctly, it may not be as easy as I originally thought (so be sure to check the links he posted in the comment above).

avatar image
1

Answer by stubbornmoose · Nov 30, 2009 at 03:30 PM

I remember reading something about performance degradation for managed to not managed calls. How bad is it?

When I implement a managed c++ project, it becomes dot.net assembly and I assume that performance wont be different as calling regular c#? Is that right?

Thanks

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 jashan · Nov 30, 2009 at 04:01 PM 0
Share

Yes, that's right: A managed c++ project would not have the overhead of p/invoke (not sure if it's also called p/invoke in $$anonymous$$ono) ... however, I think that would be a separate question ;-)

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

No one has followed this question yet.

Related Questions

Do Native Mobile Plugins Require Pro? 1 Answer

Speech Recognition Unity Pro 2 Answers

BlackBerry : How to add needed native shared libraries into BlackBerry Plugin? 0 Answers

Plugin Android that doesn't work anymore in Unity 4.3 0 Answers

How to add i-ad for android unity game? 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