Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Fruit Ninja 2

  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Fruit Ninja 2

  • Rank

Profile Information

  • Gender
  • Location:
  1. thank you very much that was the solution, yesterday it seems that I made the mistake of putting the i ++ inside the else and I did not realize. Thank you.
  2. I'm sorry for my English. My Unity 2017.3.0f2 worked fine yesterday, but when I loaded my project today, it froze when I tried to create an instance of the object, identify the code that caused this error and I share it with you, I do not know what the problem was inside the code, it worked fine yesterday , I thought that the cycle produces this error, but I do not see anything wrong inside the code, please need help with my code, what I try is to capture all the Gameobjects in front of the object, and that they are saved in an array, to later use the position of these GameObject to instantiate a bomberman-style bomb, and check for hits.Length greater than zero. Here I leave the code already commented: void CaptureAllDelante(){ RaycastHit[] hits; hits = Physics.RaycastAll(transform.position, Vector3.forward, Potencia); int i = 0; print ("Check if hits.length greater zero // " + hits.Length.ToString()); while (i < hits.Length) { if (hits [i].transform.tag == "Paredes" || hits [i].transform.tag == "Player" ) { break; //"if object tag is Paredes / Player, Stop while" } else if(hits [i].transform.tag == "Destructibles"){ //"if object tag is Destructibles , save object in array ObjetosDelante for use the position later" RaycastHit hit = hits[i]; ObjetosDelante [i] = hits [i].transform.gameObject; Debug.Log (hit.collider.gameObject.tag.ToString()); i++; } } for (int a = 0; a < ObjetosDelante.Length; a++) { if (ObjetosDelante[a] == null) { break; } //"if ObjetosDelante if != null instantiate Explosion in each position of object in array" Instantiate (Explosion, ObjetosDelante[a].transform.position,Quaternion.identity); } SearchObjetoDelante = false; }
  • Create New...