C# AND javascript

we have 2 coders one is well versed in c# and one is well versed in javascript>

My question is, can the languages be mixed like part of the code wrote in c# and part in javascript? it could be a dumb question but I am new to the engine. and I do not know if they mix in the engine or if it has to be done completely in one language. and of course i know each function cant be split but i mean like if i add a feature in c# and they code a feature in js can they both work for the same game

Yes, but they have to be in specific folders to work together. See here for more info: Unity - Manual: Special folders and script compilation order

1 Like

If your experience is low on programming, maybe it’s better to switch to C# as early as possible. It’s definitely one of the best engineered languages. UnityScript is not even Javascript exactly. Unity team developed their own javascript version to be able to enable javascript developers to use their engine. C# must be the best way to go for a beginner.

2 Likes

\I know c# pretty well bro, its him he is only versed in javascript. so maybe I should just tell him to work on learning java? does he have to be really deep into advanced c# to write script for the engine?

You can mix the two languages as long as pretty much everything c# is in one of the special folders mentioned above.

Where you’ll start running into trouble is down the line as your project expands, if you use any outside assets (from the asset store, for instance) in it that are written in c# then you have to also make sure they are in those folders as well. That can get really messy really fast, especially if you plan to update those outside assets. It quickly becomes more of a problem than it’s all worth.

So…

  • Your guy can learn c#, or
  • You can try to mix js and c# and hope for the best, or
  • He writes his code in js and then you convert it to c# either with a tool or by hand (with something like cSharpitron from the asset store).
1 Like

I advice beginners to start learning C# because I have 10+ years of experience on both C# and JavaScript. I know them better than my native speaking language. :slight_smile: :slight_smile:

I hope this information helps you to get away from your prejudice of “Only people that are well versed in c# tell you to go to c#”

3 Likes

I’ve actually spent the first several years with Unity releasing games written in Javascript because I didn’t know c#. It’s only with my latest game that I finally made myself learn c#, and the whole game uses that now.

I’m not well versed in c# in the slightest, but I figured out how to do it and I’ve done it. My latest game released last week and everything went smoothly.

My advice about mixing js and c# is based purely on actual production experience, not just some sort of pissing contest maneuver to prove that one language is better than another.

I don’t care what language someone writes in, if it gets the job done then that’s the one. Trying to mix js and c# in one large project is difficult and frustrating once that product starts getting somewhat complicated. That’s all I was trying to share.

2 Likes

@Ony ,

can we see that new game? :slight_smile:

1 Like

I like to keep my released work separate from my public forum “persona”. I just find it works best that way with less potential headaches for me. :wink:

Yes and thank you very much i get what you are syaing, I didnt even think bout if the “as the project expands” its going to be harder to keep together. gives me real thought into it. I didnt know they made converters though thank you for that. I think I will go by your opinion and turn there javascript into c#. because my luck it would get mixed and messed up in the later stages lol

1 Like

Awesome, I hope that works out well for you as that will allow everyone to code the way they like best. If you do go with a converter I very highly recommend cSharpitron - It’s really good. I have no relation to the developer, I just think good tools should be promoted as much as possible. :slight_smile:

Oh boy oh boy…

1 Like

Playmaker is indeed awesome and I use it myself to quickly and easily lay out and alter the flow of a program before committing things to code. I love it, but I don’t think I could make an entire proper game with it alone. It does require coding skills if you’re going to make the most of it.

I started off in UnityScript, and used it almost exclusively for a couple of years. I did this because I listened to people I respected telling me C# was more complex, but they were wrong. There is more to it, but you don’t need to use it all. UnityScript has no reason to exist.

1 Like

@Jessy . Thank you for reflecting my feelings so directly. I just didn’t want to break some people’s hearth but I think you did it :slight_smile:

JavaScript is popular, not UnityScript .. I think you’re getting the 2 mixed up.

For reference, From last September :
http://blogs.unity3d.com/2014/09/03/documentation-unity-scripting-languages-and-you/

1 Like

This statistics looked a bit different before the witchhunt against Unity Script started. It was 50/50 at one point. And even nowadays it’s 20%. So i wouldn’t exactly call it irrelevant.

I will never get this racism against a programming language. It’s a tool. Would you be rassistic against a hammer? Every language has its purpose as long as there is somebody using it happily. There are even some folks using Brainfuck for programming.

Ontopic: try to use one language if even possible. As pointed out, using both languages in one project is possible, but makes too much trouble.

Careful with the racism call Tiles, it’s a bit emotive. I’m just the messenger … not preaching here.

And so is the whole versus debate. But i see your point. Apologies in case i did hurt you.

1 Like

http://forum.unity3d.com/threads/boo-is-core-of-unityscript.146552/#post-1002728

I can’t speak about the merits of the language. I can tell you that I didn’t learn it because its documentation was abysmal, for a beginner, unlike that of the other options.

I’m trying to figure out an analogy to how I see these two languages that I can relate to other people. I agree that they’re tools, but not hammers. I’ve yet to see a tool that is better than a hammer for what it does, and how much it costs. For now, here’s what I’ve got:

UnityScript is a 2-conductor humbucking guitar pickup, and C# is 4-conductor. C# can be wired in series or parallel (or even split or out out-of-phase, if you can deal with hum), for more tonal options, but you can let your guitar manufacturer choose the wiring/tone, and never open up the cavity and see the wiring, if that’s not your thing. UnityScript is what a certain player might want, but C# can give them the same tone, and leave possibilities open for future opinion changes.

I asked my wife if she could come up with anything more relatable to anybody. I’ll let you know if either of us do. The gist of it is, I don’t see UnityScript as being different from C#, like actual JavaScript, C++, and Swift are. I see it as being gimped C#.

3 Likes