- Home /
This question was
closed Jun 08, 2013 at 09:00 PM by
Griffo for the following reason:
Solved
Convert C# to JS
Hi, I've converted two C# scripts to JS but I'm having trouble with one line, I just cant seem to get it right, can anyone please tell me how I should convert the 3rd line below to JS please.
Intensity = music.GetComponent<intensityAction1>();
Intensity.music = music;
Intensity.Audio = Intensity.music.GetComponents<AudioSource>();
Comment
I thought this would do it, but get error - InvalidCastException: Cannot cast from source type to destination type.
music.GetComponent(intensityAction1).Audio = music.GetComponents(AudioSource);
Audio is an array and music(GameObject) has 5 AudioSources attached ..
Done it -
music.GetComponent(intensityAction1).Audio = music.GetComponents.<AudioSource>();
Follow this Question
Related Questions
Can anyone translate this to JavaScript? 1 Answer
C# GetComponent 3 Answers
Traslate C# to JS 1 Answer
Is it okay to use both c# and javascript in one scene or game? 0 Answers