[Closed] Type Could not be Resolved - Cycle

I am very confused -_-

I read this question from some other people, and I understand what the error is trying to tell me, but all I did was eliminate a reference to one script that doesn’t even show up in the rest of the other script, and I get a host of these things…

The script that I edited isn’t even involved with these scripts!

Assets/Scripts/Rings/RingMaster.js(85,50): BCE0070: Definition of ‘RingMaster.CheckRings()’ depends on ‘EnemyCounter.EndWave()’ whose type could not be resolved because of a cycle. Explicitly declare the type of either one to break the cycle.

Assets/Scripts/Enemies/FlyThroughTimer.js(61,30): BCE0070: Definition of ‘FlyThroughTimer.ExitScreenEnemies()’ depends on ‘EnemyCounter.EndWave()’ whose type could not be resolved because of a cycle. Explicitly declare the type of either one to break the cycle.

The following 3 functions are from different scripts and correspond to the errors respectively:

function CheckRings(){
	
		finalText = Instantiate( text, Vector3( 0.85, 0.5, 0 ), Quaternion.identity);
		pickText( reportedRings );
		finalText.fontSize = 90;
		finalText.fontStyle = FontStyle.Italic;
		StaticFunctions.FadeIn( finalText.gameObject, 0.0, 1.0, 1.0, false );
		ship.AddEnergy( reportedRings*10 );
	
	if( ringTotal == reportedRings ){
		
		GameObject.Find("Master").GetComponent( PointTracker ).AddPoints( ( 500) );
	}
	ship.AddEnergy( reportedRings*2 );
	Master.dodgingWave = false;
	StartCoroutine( FadeAll( myText, myTotal, mySlash, finalText) );
	camera.main.GetComponent( EnemyCounter ).EndWave();
}

divider

function ExitScreenEnemies(){
	
		flyCount = 0;
		spawner.ClearGrid();
		var enemiesArray : Component[] = GetComponentsInChildren( Transform );
		for( var u : Transform in enemiesArray ){
				if( u.transform.Find("Gun")) u.transform.Find( "Gun" ).GetComponent( EnemyTargeting ).can_Shoot = false;
				if( u.transform.GetComponent( EnemyMovement) ) u.GetComponent( EnemyMovement ).ExitScreen();
				}
		enemyCounter.EndWave();
		enemyCounter.screenEmpty = true;
}

And the EndWave function:

function EndWave(){
	GameObject.Find( "EnemyGrid" ).GetComponent( FlyThroughTimer ).countDown = false;
	hud.Fade( 1.0, 0.0, 1.5, false );
	Instantiate( endWaveDisplay, Vector3(0,0,0 ), Quaternion.identity );
	yield WaitForSeconds( 2.0 );
	endWaveUp = true;
}

What’s up???

Thanks! - YA

I had this same error in my game (no recursion).

Everything was fine until today when the compiler decided that it cared about this and spit out this error:

Assets/scripts/continueController.js(422,36): BCE0070: Definition of 'continueController.setStoreText()' depends on 'localize.heartPack1Desc()' whose type could not be resolved because of a cycle. Explicitly declare the type of either one to break the cycle.

Given that I was not using recursion, or anything special for that matter, this error was confusing to me. The solution was to explicitly define the output type of one of my functions, which I’ve never done before:

Initially, my function looked like this:

function heartPack1Desc() {
        return IAPController.lifePackTitles[0];
    }

So my assumption was to do this:

static function heartPack1Desc() {
    var content : String = IAPController.lifePackTitles[0];
    return content;
}

But that’s not what the compiler wanted me to do. The compiler wanted this:

static function heartPack1Desc() : String {
    return IAPController.lifePackTitles[0];
}

Which makes total sense, if you know that declaring the type of a function is a thing at all, which I didn’t.

I’m answering this for posterity, in case someone comes along in the future, like I did today.

For anyone else who runs into this error, this can also be due to the yield statement in the last script.