Closing credits generates a nice-looking credit roll.
- 0_Docs/ - Folder containing the documentation
- Editor/ - Folder of the Unity Editor scripts
- Prefabs/ - Contains the scripts for each credits line type
- Credits.cs - Main script
- 2_Prefabs/ - Contains all the GUI prefabs
- CreditsExample.unity - Demo scene
- CreditsExampleScript.cs - Script used in the demo scene
- Resources/ - Contains a credits.xml file and a texture used in the demo
After importing the package, the first thing you will want to do is to create a Credits file. Simply go to the Window menu and select Credits Editor.
When you first open the editor window, only two buttons are available on the top left of the window: a button for creating a new file and one for opening an existing file, they are pretty straightforward. Click on the first button and create somewhere in your project the credits file.
The green + button at the top will add a new row at the bottom of the credits. In the main part of the window are the credits rows. For each row you can:
- Choose the type:
- Empty Space adds empty rows.
- Image will display a texture. You must enter the name of the texture which is in a Resources folder, because it will be loaded with Resources.Load().
- Single Column is a simple centered text.
- Title is a big centered text.
- Two Columns is two columns with a header and a text.
- Enter the text or the data corresponding to the row type.
- Up and Down buttons will reorder the rows.
- Add will insert a new row below the current one.
- Delete will delete the current row.
When your credits file is complete and saved, you must drag and drop the 2_Prefabs/Credits prefab in your root GUI gameobject. Some people directly used the demo scene for their game.
- Credits File
- The credits file you have created using the Credits Editor.
- Play On Awake
- Closing credits will start as soon as the scene is loaded when set to TRUE.
- Speed of the credits. 50 is a good value.
- Fade Time
- In how many time the credits will fade in and out. In seconds.
- Prefab ...
- Fill those by drag and dropping the corresponding prefabs from the 2_Prefabs/ folder.
Modifying the credits
This new version of Credit Roll uses the new GUI system of Unity 4.6/5. You can change the color, the size, the font and all the properties for each type of line by altering the prefabs in the 2_Prefabs/ folder.
The height determines the line spacing, as the text is vertically align to the top. This allows you to set a different line spacing for each type of line.
Don’t forget that you can add scripts like Shadow or Outline for your texts, which are shipped by default with Unity.
Scripting and callbacks
If you did not set Play On Awake to TRUE, you can start the closing credits with the
The Credits class is set as a singleton for convenience:
If you want to know when the credits ends, create a script and use the C# event system like this:
Credits.getInstance().endListeners += new Credits.CreditsEndListener(creditsEnded); // creditsEnded is the name of the function
void creditsEnded(Credits c)
// Do something, like changing scene
You can find those examples in the 3_Demo/CreditsExampleScript.cs file.
You now know everything about this addon!