Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by youngapprentice · Sep 20, 2013 at 12:52 AM · typecycle

[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

Comment
Add comment · Show 12
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image TrickyHandz · Sep 20, 2013 at 01:07 AM 0
Share

Often times when your resolve one issue, it will allow the compiler to see more errors. It is not uncommon for this to happen, I had one project where I fixed 3 errors and 50 more popped up as soon as the compiler could get to them. In my experience the "type could not be resolved because of a cycle" is due to some kind of recursive call. I would need to see you code to tell you more.

avatar image Eric5h5 · Sep 20, 2013 at 01:37 AM 0
Share

You could always just do what it says and explicitly declare the type of the functions.

avatar image youngapprentice · Sep 20, 2013 at 01:44 AM 0
Share

There were no errors before hand. I literally omitted a completely useless variable declaration ( I did a search for it in the code and it didn't pop up ) in an unattached script. Now there are these issues, and they won't go away even if I add the omitted code back in. -_- I will edit my answer to include the pertinent functions.

avatar image youngapprentice · Sep 21, 2013 at 08:01 PM 0
Share

No idea? :(

avatar image meat5000 ♦ · Sep 21, 2013 at 08:10 PM 0
Share

All scripts get compiled whether you use them or not. If you dont intend to use a script, remove it completely or rename it in explorer to no longer be 'code', for example .js_ so the script is still there but it's no longer compiled.

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by ensomniac · Jun 18, 2014 at 11:18 PM

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image youngapprentice · Jun 19, 2014 at 01:04 AM 0
Share

You only need to declare a function type if you are returning a value.

For instance, in C#, That would be written as:

 static String heartPack1Desc(){
 return myString;
 }

Thanks for posting this! I'm sure it will clear things up for people that look here in the future!

avatar image
0

Answer by seth_slax · Sep 08, 2015 at 01:43 AM

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

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Audio Score Trigger Help 0 Answers

I can't get my script to work I get an error. [Please Help!] 0 Answers

Activating Bool Array in sequence. 2 Answers

Where can I find a list of variable types for use in Javascript? 3 Answers

Redim a variable 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges