Im very confused as to why this do while loop doesnt work. I always get stuck in an infinite loop. It works if i only have one condition but as soon as i insert multiple conditions it doesnt leave the loop.
do {
ran = Random.Range(0,names.length);
var ran2:int = Random.Range(0,objectComponants[names[ran]].length); // the length counts the componants array within the hashtable
var chosenComponent:Component = objectComponants[names[ran]][ran2];
}
while ((typeof(chosenComponent)!= Transform) || (typeof(chosenComponent)!= ParticleSystem));
Its waiting to find if the chosen component is either a transform or particle system then it should break.
I worked out that instead of || you need to use &&. But i have no idea why? I would have thought || is more appropriate as it should break when either of the two types are found. Im afraid whilst && fixes the problem, i dont understand why.