Search Unity

C++ scripting

Discussion in 'Scripting' started by Darko, Feb 29, 2008.

  1. Darko

    Darko

    Joined:
    Aug 28, 2007
    Posts:
    100
    Is there a way to do the Unity "scripting" in native C++?
    (ok, then you can not call it "scripting", but I think you get the point)

    I know that the managed .NET languages are not a performance problem
    but there are some other advantages in using C++.
    (for example a huge pool of Professionals already used to C++)

    Thanks,
    Darko
     
  2. NCarter

    NCarter

    Joined:
    Sep 3, 2005
    Posts:
    686
    You can write plugins using C++ if you have Pro, but that's it. That's probably not a very good solution for your main game logic; it's more appropriate for interfacing with external APIs or processing data which is only used indirectly by your Unity scripts.

    Speaking as a self-taught C++ programmer who has spent several years making games on an amateur basis, I think that the move to C# is easy and worthwhile, and the language is much more suitable for the way Unity works than C++ would be. There are also plenty of professionals who know C#, just as there are plenty who know C++.
     
    leozhang1 likes this.
  3. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    Also worth noting: C++ plugins are _not_ supported in the web player, thus they're usable only within authoring and stand-alone executables.
     
  4. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    Wow. I didn't know that. Considering it's UT's mission to make possible the best 3D content "on the web" I think it's kind of weird that this is even in there, now.
     
  5. 64746c

    64746c

    Joined:
    Oct 21, 2007
    Posts:
    181
    From what I understand, including C++ plugins in a webplayer is pretty much impossible because you would have to create an entirely new browser plugin. It works in standalone players because the entirely new plugin is included anyway.

    Please correct me if I'm wrong.
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It's probably more of a security thing. Plenty of Unity content is stand-alone, so I don't see any issues with that.

    --Eric
     
  7. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
  8. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    @Jessy: supporting plugins in the web player would introduce significant security concerns that we are simply not willing to take on right now. And to me (and others), this does not prevent us from achieving our goal of being the 3D tool/player of choice for content on the web, desktop and beyond...
     
  9. podperson

    podperson

    Joined:
    Jun 6, 2006
    Posts:
    1,371
    I'd suggest that 'the best 3D content "on the web"' doesn't include gaping security holes (like ActiveX). As soon as you allow arbitrary code execution via web browsers you're just a gigantic security nightmare waiting to happen.