- Home /
Translation music script from c# to js
hi, recently i've had a problem, how to make continuos the sogns between levels and avoiding to instantiate another music, the only solution that i've found was a c# script, it works, but i'm not able to edit that cause i don't know c#, only (a bit) javascript. So... can please someone translate that? thanks.
using UnityEngine;
using System.Collections;
public class MyUnitySingleton : MonoBehaviour {
private static MyUnitySingleton instance = null;
public static MyUnitySingleton Instance {
get { return instance; }
}
void Awake() {
if (instance != null && instance != this) {
Destroy(this.gameObject);
return;
} else {
instance = this;
}
DontDestroyOnLoad(this.gameObject);
}
}
There are many answers for a music singleton in uJS on this 'site :
Answer by getyour411 · May 10, 2014 at 11:25 PM
http://answers.unity3d.com/questions/12911/what-are-the-syntax-differences-in-c-and-javascrip.html
Search for many similar posts.
very helpful also for upco$$anonymous$$g issues and for starting to learn some c# sintax rules, many thanks!
Your answer
Follow this Question
Related Questions
How can i set my animation samples to BPM of music 0 Answers
Translate code from C# to Javascript 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers