Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Game Development

Bruce Röttgers
Bruce Röttgers
18,211 Points

Do Unity Games coded with C# work on Mac

Hey,

in Unity you're able to script in C# and JS. My questions:

  • What are the advantages of scripting in C#/JS?
  • Am I able to play my game coded with C# on Apple (non-Win) devices?

Thanks for reponses,

Bruce!

2 Answers

João Elvas
João Elvas
5,400 Points

Hello,

To answer your question as an experienced developer and computer engineer. The language you code has barely nothing to do with the OS you will be running the game.

You are probably asking that because C# was designed by Microsoft. But it has nothing to do with that.

C# is high level programming language. That means the level of abstraction from the hardware is much higher than a low level one. So after you code, Unity will compile the code to machine code. It is up to YOU to select the system and machine you want to run.

Good luck!

Bruce Röttgers
Bruce Röttgers
18,211 Points

Thanks!

I want to dive into Web Engineering and Games. Would you recommend to start learning Unity with JS or C#? Because if I'd learn JS I could use it for Web and Unity?

Read my post, please :smile:

C# is way, way more popular than JS for Unity. I highly recommend C# for unity. And, actually it is easy to build a project for different platforms, like iOS, Android, Web (using OpenGL to display 3D), even Xbox and PlayStation!

João Elvas
João Elvas
5,400 Points

That depends, if you want to start fast and just make a game to play around and then leave it, go for JS, everything is more straight forward.

On other hand, if you want to dive deep in game development and stay here for a long run, go for C#. You ll unlock a lot of possibilities in every field of computer science. (e.g. Xamarin, .NET, etc.)

There is way so much to say about that, so just stick with that.

Good luck!

Bruce Röttgers
Bruce Röttgers
18,211 Points

OK I'm now sure that I'll choose C#, because of I want to dive deep in Game Dev.

Okay, if you are familiar with JavaScript, you should think that the code that Unity uses in JavaScript is very different then the JavaScript you are used to.

Here's an example of Unity code in JavaScript:

#pragma strict
public var sphereRadius: float;
var audio: AudioSource;
function Start() {
    audio = GetComponent.<AudioSource>();
}
function WarningNoise() {
    // Play a noise if an object is within the sphere's radius.
    if (Physics.CheckSphere(transform.position, sphereRadius)) {
        audio.Play();
    }
}

C# in Unity is WAY more popular than JS for Unity.

So, this means it's easier to ask questions in Unity's community because more people know C# for Unity then JS for Unity.

Just stick to C# for Unity, ok? It's easier to start with and it's more understandable.

Also, to answer your other question, yes, Unity does work on a Mac. You can write either C# or JavaScript and Unity will still be able to run on a Mac. However, you can't do VR for Unity on a Mac. You can only do it on Windows.

Maybe in the future Unity will let Mac users do VR on Unity!

I hope this helps. ~Alex

Bruce Röttgers
Bruce Röttgers
18,211 Points

Wow, you've got a lot of achievements!

Yea. I've been on Treehouse for almost 2 and a half years :)

I'm #1 on Game Development points on Treehouse. Look on the leaderboard :grin:

(I forgot a lot of the Game development stuff lol)