Final scene like a puzzle

Hello everyone :slight_smile:

I’m creating a game where player collecting objects - balls - C#.

How could i make a final scene with some kind a puzzle statistics?

On the end of the game one big ball is filling up with small balls, and number of small balls is equal with number of collected balls during the game.

Thanks in advance :slight_smile:

using UnityEngine;
using System.Collections;

public class Balls : MonoBehaviour {

	//Number of balls is a static variable to allow you to edit from another script.
	//Use Balls.numberOfBalls in another script to change it.
	static public int numberOfBalls = 10;

	//This game object will represent the balls faling into the big ball.
	public GameObject ball;

	// Use this for initialization
	void Start () {

		//A for loop will basically count a unknown number for you. The first part of the for loop defines a variable for you, i stands for index, 
		//The next part is the requirements for the loop to meet in order to continue, the third part "i++" is what happens if the loops requirements is met. 
		//This counts the number of balls you have collected and will run the instantiate that many times.
		for(int i = 0; i <= numberOfBalls; i++){
			Instantiate(ball, new Vector3 (0, gameObject.transform.position.y + i ,0), Quaternion.identity);
		}
	}
}

//Sorry if I havn't explained it well.

As explained badly in the code’s comments all you have to do to make this work is make a new script called Balls, add it to an empty game object that represents the position that you want the balls to start at. As long as you edit the numberOfBalls variable to be equal to the amount of balls you have collected in any of your scripts that counts them it should work.

Please let me know if you have any questions about this.
Some tips for posting questions in the future, let people know what language your using, I hope your using C# but if not I can change it to JS, secondly post what code you have related to the problem, it can speed things up tremendously.
Good luck with your game.