Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by cherry williams · Aug 16, 2010 at 04:33 AM · compatibilitylanguage

C# scripting and Javascript in the same project?

I am just beggining with unity and i am going to prototype a vehicular combat game. I have decided to use the tutorial on the unity website as the base code for the behaviourand control of the vehicle, these scripts are already provided with the tutorial in javascript.

However i am not very comfortable with javascript, not enough to be able to write all of my scripts in it, i am much more comfortable using C# and i have a 12 week time limit to achieve a working prototype so i don't have a lot of time to become comfortable with javascript.

My question is this: is it possibble to have scripts in 2 different languages, javascript and c# in the same game project? While i wouldn't change scripting languages within the same script file a game object may have scripot files using both languages, is this possible?

P.S. I am aware this is not the proper, clean or best way to achieve what i want but time is a factor, and the focus is on getting a working prototype even if it is "quick and dirty". I would work on converting the code to one language at a later date when i have time.

Thank you in advance.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by · Aug 16, 2010 at 04:57 AM

You can use scripts from both languages in the same project. I've seen Eric5h5 suggest that you read the script compilation reference page when mixing languages.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image mikelyons · Nov 24, 2013 at 04:26 AM 0
Share

That link is busted :(

avatar image paulygons · Nov 24, 2013 at 04:52 AM 0
Share

this might be it http://docs.unity3d.com/Documentation/$$anonymous$$anual/ScriptCompileOrderFolders.html and this http://docs.unity3d.com/412/Documentation/$$anonymous$$anual/Scripting.html

avatar image
2

Answer by MarkrosoftGames · Jan 28, 2014 at 05:59 AM

from this link http://docs.unity3d.com/412/Documentation/Manual/Scripting.html

Accessing a variable defined in C# from Javascript To 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.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by zannghast · Sep 08, 2010 at 07:34 AM

What Marowi said was true. As an added fact (which you'll also find in the link Marowi provided), you should be wary of how your scripts access different objects defined in scripts of other languages.

If you haven't already, I suggest you read the page in the link, everything's right there.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Convert .js to C# 2 Answers

Cant get C# to talk to JavaScript 3 Answers

Script translation 2 Answers

I have my items in inventory, now if I could only use them... 1 Answer

How is the relationship between Rodrigo Barreto de Oliveira and Unity? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges