Unity3d: Change value of the variable in C# script from UnityScript JS


The entire game was programmed in Unity3d with UnityScript(JS), however one C# script was included (GameCenter integration).

At the moment Game Center Script (C#) is attached to the First Scene Object (not destroyable object, not sure if it needs to be not destroyable, please advise).

In another scene, where GameOver is happening, when GameOver is triggered, the attached UnityScript(JS) has to be able to change Variable in the C# script (from false to true).

(Once the Variable in C# changes to true, score is being submitted to Game Center with the help of C# script.)

Changing variables from one UnityScript in another is not a problem, but how to change variable in C# from the UnityScript?

In Unityscript it would be something like that:
GameCenterJS.gameOver = true;

But it doesn't work as
GameCenterCS.gameOver = true;

What is the proper way to do it?

Thank you for your advice
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hans LangerCommented:
So, you have an object with a c# script that is accessible from another object that have a JS script.
The option that i would trye would be:

1) create a "gameOver" Public Function in the c# script, so you just can call it from the JS using: GameObject.gameOver(false), and inside the function i would change the value of the variable.

2) or you can have a static class that contain all the "shared" variables.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Game Programming

From novice to tech pro — start learning today.