- Home /
.cs and .js can work together but..
In my case for example I have .cs on my player and .js on my car suppose when I hit "E" button the camera change from player to car as im inside. I cant prove this yet because at the moment my car float as there a wind blow and I believe to be problem with the tyre script or export. In the other scene that has proven work, the player and the car is fully .js I wonder if anyone know .js and .cs can collaborate together to give me passion know that this will work and would be helpful if you know how to solved the floating issue should it be easy
email : removed
don't post your e-mail on a public forum unless you are addicted to $$anonymous$$ALICIOUS SPA$$anonymous$$!
you can use both .js and .cs in a single project, but it only goes ONE WAY, they can't talk back and forth
Answer by Seth-Bergman · Mar 16, 2013 at 10:50 AM
you can use both .js and .cs in a single project, but it only goes ONE WAY, they can't talk back and forth
to make this work you would put the one to compile first in a folder which will compile first:
http://docs.unity3d.com/Documentation/ScriptReference/index.Script_compilation_28Advanced29.html
for example, you can put your C# files in a folder called "Plugins" inside your Assets folder.. then, the .js scripts will be able to see them. BUT, the C# scripts will NOT be able to see the javascript.
Do yourself a favor and just pick one language, you can only use the other if you know it only goes one way
thx Seth for re$$anonymous$$der
Seems to me my car is .js and I have to change it to .cs too now because even if this different script work I can only change camera from player to car but cant back to player I guess.
I cant convert it though that meant I probably revamp a new car script hopefully no wind floating will occur to the car object.
cars are tough, keep at it!
you should be able to convert .js to .cs pretty easily, all you do is:
change the word "function" to "void"
change var declarations from "var myVar : Type;" to "Type myVar"
add the "new" keyword for any RECTS (such as in GUI) and VECTOR 3's
fix any yield statements (pain)
and if there are STILL errors...
good luck!
Yes they are
Thanks for that because the .js script is good and theres no ready made .cs that can function the same so converting is a preferable at the moment and I will try
try your best and if all else fails post your best effort in another question, you will probably get help if you can get close on your own!
(also, if an answer solves your question,please be sure and accept it by clicking the check mark! thanks!)
Yes I will
Now I learn to checkmark an answer thanks
will try to do that on my previous post when I have the time
Your answer
Follow this Question
Related Questions
How to edit scene gravity? 0 Answers
Player flies up into the air when walking 3 Answers
Can I emulate simple space-like gravity? 2 Answers
Change controller gravity below a certain level? 0 Answers
Game Object floats away 2 Answers