1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Are you an artist or level designer going to Unite Europe? Join our roundtables there to discuss artist features.
    Dismiss Notice
  6. Unity 5.6 is now released.
    Dismiss Notice
  7. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

Unity and C++

Discussion in 'General Discussion' started by d0100, Nov 22, 2010.

  1. d0100

    d0100

    Joined:
    Nov 22, 2010
    Posts:
    2
    Can I use C or C++ in conjunction with Unity? I have a C snippet that gathers raw input from the computer, and a C++ class to translate into mouse moves.
    I know there is the WinMultyMouseSDK wich is in C#, but I didn't want to learn C#. Do I have to?
     
  2. DjOscar527

    DjOscar527

    Joined:
    Nov 15, 2009
    Posts:
    800
    Well the main scripting languages used in unity are c# and unityscript, so you should probably learn one of them. Although I think you can use c and c++, then compiled them to a dll and use them in Unity as plugin, how ever it requires unity pro and it won't work on webplayer.
     
  3. Daniel-Brauer

    Daniel-Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,314
    You could learn Unityscript or Boo, but if you're a C programmer I would recommend C#.

    You should be able to adapt the C++ you have into a plugin in order to feed Unity input from multiple mice. From there, I suggest leaving unmanaged code behind entirely, learning C#, and enjoying the general productivity boost that writing Unity scripts will give you.
     
  4. d0100

    d0100

    Joined:
    Nov 22, 2010
    Posts:
    2
    UnityScript is something else, or is it Javascript? I saw there are only Javascript, Boo C# in the Docs.
    What does Boo have in special to be used in Unity?
     
  5. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,596
    It might be refered too as "Javascript" but its a unity specific language with no counterpart outside of Unity.

    Boo: nothing, its just an alternative that is not c style :)
    Also it forms the base for UnityScript at all
     
  6. justindarc

    justindarc

    Joined:
    Feb 2, 2011
    Posts:
    1
    Actually, from the syntax and the fact that Unity is built on Mono, the "UnityScript" language is really a minor variation of Microsoft JScript. ( http://en.wikipedia.org/wiki/JScript ) - The closest thing to compare it to would be ActionScript 3.0.
     
  7. dissid

    dissid

    Joined:
    Dec 16, 2010
    Posts:
    41
    UnityScript sure looks like ECMAScript, if you know one of them, it's easy to get into.
     
  8. tatoforever

    tatoforever

    Joined:
    Apr 16, 2009
    Posts:
    2,867
    If you are a C/C++ programmer, you'll feel at home with C#. It have lots of similarities of Java and C++.

    Tthe best thing to do is build a DLL C++ plugin, drop it into Unity Project and accees to it, create a wreapper or whatever you need.
    Cheers,
     
    Last edited: Feb 3, 2011
  9. Ethan

    Ethan

    Joined:
    Jan 2, 2008
    Posts:
    497
    And if you want to use C/C++ plugins you need Unity Pro and C#. Only C# offers the interface to those plugins afaik.

    It's easy to write the C# stuff for a C++ programmer - i started the same way :)