- Home /
Question by
Universee · Oct 18, 2014 at 10:02 AM ·
javascriptremove
How to remove a word from string
Yo , I've got problem with string.I wrote small script who plays sound and show it on GUIText , but it shows me for example: "C (UnityEngine.AudioClip),G (UnityEngine.AudioClip)".I tried to remove this and I failed.
#pragma strict
var losowa : int ;
var tekst : GUIText;
var C : AudioClip;
var D : AudioClip;
var E : AudioClip;
var F : AudioClip;
var G : AudioClip;
var A : AudioClip;
var H : AudioClip;
function Start()
{
var wynik = new Array();
var tablica = new Array(C,D,E,F,G,A,H);
var licznik : int=0;
while(licznik<2)
{
losowa = Random.Range(0,7);
audio.clip = tablica[losowa];
wynik.Add(tablica[losowa]);
audio.Play();
yield WaitForSeconds (2);
licznik++;
}
var str: String;
for (var i = 0; i < wynik.length; i++)
{
str = str + wynik[i].ToString();
}
print(wynik);
tekst.text=str;
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613165340im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
whats wrong? nullpointer 1 Answer
Compiler errors need help with. Please 1 Answer
Web service not working in Web Player build 0 Answers
Making a rigidbody cube snap 90 deg at a time 1 Answer
Setting Scroll View Width GUILayout 1 Answer