laminutederire Posted January 27, 2016 Report Posted January 27, 2016 I'm a newbie, so I figured I might ask Has anyone ever used a leap motion sensor (link) with Unity?If so, the modules for that hardware for Unity are written in C#, but with my group we wanted to code in Javascript. I haven't found infos about how to use different languages in the same game, is that possible and if so is it hard?I know games are usually designed like that with different languages for optimization purposes, but is it possible with Unity? Thanks in advance for your expertise! Quote
clankill3r Posted January 27, 2016 Report Posted January 27, 2016 I think you have better luck asking on either the leap or unity forum.I guess it is possible. Quote
laminutederire Posted January 27, 2016 Author Report Posted January 27, 2016 I think you have better luck asking on either the leap or unity forum.I guess it is possible. I do that too but I figured having experience from people here might help Quote
clankill3r Posted January 27, 2016 Report Posted January 27, 2016 I have a bit experience with leap and a bit with Unity but not the combination.How do you normally load the library when you use leap with javascript? laminutederire 1 Quote
laminutederire Posted January 27, 2016 Author Report Posted January 27, 2016 (edited) @clankill3rThe library for Unity is in C#, a language I don't know, I don't know Javascript either, so I'll have to learn either one of them.(I basically only know well Python)And I heard JS is easier than C# but doing the game with the leap in JS would mean either doing it without Unity, and end up with something really simplified ( got only 3 months to do the project after study hours ), or trying to do it in Unity, mixing scripts in C# (leap motion scripts ) and JS (my scripts), or doing it all in C# in Unity.I'm just afraid not to have enough time to learn C# because it looks frightening, what would you recommend? Edited January 27, 2016 by laminutederire Quote
Corwin Posted January 27, 2016 Report Posted January 27, 2016 (edited) About mixing JS and C#, my understanding is that it is possible but a bit messy because you have to understand script compilation orderAll scripts that are compiled in this step have access to all scripts in the first group ("Standard Assets", "Pro Standard Assets" or "Plugins"). This allows you to let different scripting languages interoperate. For example, if you want to create a Javascript that uses a C# script: place the C# script in the "Standard Assets" folder and the Javascript outside of the "Standard Assets" folder. The Javascript can now reference the C# script directly.See here: http://docs.unity3d.com/412/Documentation/ScriptReference/index.Script_compilation_28Advanced29.html EDIT: Maybe this one is clearer:Accessing a variable defined in C# from JavascriptTo access variables defined in C# scripts the compiled Assembly containing the C# code must exist when the Javascript code is compiled. Unity performs the compilation in different stages as described in the Script Compilation section in the Scripting Reference. If you want to create a Javascript that uses classes or variables from a C# script just place the C# script in the "Standard Assets", "Pro Standard Assets" or "Plugins" folder and the Javascript outside of these folders. The code inside the "Standard Assets", "Pro Standard Assets" or "Plugins" is compiled first and the code outside is compiled in a later step making the Types defined in the compilation step (your C# script) available to later compilation steps (your Javascript script).In general the code inside the "Standard Assets", "Pro Standard Assets" or "Plugins" folders, regardless of the language (C#, Javascript or Boo), will be compiled first and available to scripts in subsequent compilation steps.http://docs.unity3d.com/412/Documentation/Manual/Scripting.htmlGood luck, unity is nice but can be a bit weird sometimes to get to think within its boundaries and work around its limitations Edited January 27, 2016 by Corwin laminutederire 1 Quote
laminutederire Posted January 28, 2016 Author Report Posted January 28, 2016 About mixing JS and C#, my understanding is that it is possible but a bit messy because you have to understand script compilation orderSee here: http://docs.unity3d.com/412/Documentation/ScriptReference/index.Script_compilation_28Advanced29.html EDIT: Maybe this one is clearer:http://docs.unity3d.com/412/Documentation/Manual/Scripting.htmlGood luck, unity is nice but can be a bit weird sometimes to get to think within its boundaries and work around its limitations merci beaucoup i wasn't sure I understood it right Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.