- Home /
In Game Credits?
Hi Guys, So I Have nearly finished my Main Menu GUI Screen! But I would like to add a credits scene.
So I have already made the code so when the player clicks the Credits button it loads up a separate scene but I can't work out the script to make the actual credits e.g Created by... (then next line) Music by... etc.
That way I will be soo close to finishing the main menu screen :D Thank you in advance to anyone who can help! -Izzy
Yeah True. I will not be spending loads of time on these small features but once I have Finished the levels $$anonymous$$enu etc.. I might just add them in.
Thanks anyways
i dunno i think companies are starting to add more into the menu, maybe not in mobile games but i have found more games putting the instruction booklet in the game ins$$anonymous$$d of in the box, and the way games are going we will see more of this.
i can see how if there is a lot of people working on a game it can be annoying, but for a small $$anonymous$$m it only takes 20 $$anonymous$$utes.
put your entire credits into one gui element and move the gui up past the camera viewport that renders gui, nothing fancy but its only credits
yeah I just think It would help out the people that helped me make the music etc..
Thanks anyway :D
Omit the credits because most people don't care about them nowadays? When have people ever really cared about the credits? On movies, on TV shows, on a CD... you don't do it for the customers, you do it to recognize the people who helped work on the game.
That said, there are ways to make credits more interesting. The Incredibles had a great end-credits sequence, and Scribblenauts had a good one too.
Answer by robin-theilade · Sep 20, 2012 at 04:42 PM
This very simple credits scroller should get you started.
using UnityEngine;
public class Credits : MonoBehaviour
{
private float offset;
public float speed = 29.0f;
public GUIStyle style;
public Rect viewArea;
private void Start()
{
this.offset = this.viewArea.height;
}
private void Update()
{
this.offset -= Time.deltaTime * this.speed;
}
private void OnGUI()
{
GUI.BeginGroup(this.viewArea);
var position = new Rect(0, this.offset, this.viewArea.width, this.viewArea.height);
var text = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Quisque a mauris sit amet neque posuere molestie at laoreet lorem.
Suspendisse accumsan pretium ante, sit amet tincidunt tortor tempor ac.
Sed condimentum mi id nisi egestas non vulputate urna porttitor.
Mauris sed mauris vitae velit imperdiet vulputate ut nec velit.
Maecenas convallis posuere velit, quis interdum justo mattis vel.
Aliquam hendrerit ullamcorper dui, a laoreet dolor ornare sit amet.
Praesent sed odio purus, a convallis tellus.
Nulla porttitor arcu vel ipsum luctus euismod.
Duis tincidunt vehicula nisl, nec venenatis velit convallis non.
Sed semper metus egestas libero venenatis imperdiet.
Pellentesque venenatis orci nisi, vel fringilla dolor.
Nam at lacus massa, commodo pellentesque velit.
In accumsan velit sed nisi aliquam tristique.
Ut eu quam tellus, eu egestas diam.
Maecenas vel dui vitae orci accumsan molestie.
Donec pulvinar metus nec turpis rutrum quis gravida ante dignissim.
Ut quis justo quis nisl eleifend ornare non at ipsum.";
GUI.Label(position, text, this.style);
GUI.EndGroup();
}
}
Use the style to make the default font larger (about 24px?), change the color so the text is visible on your background and set the alignment to Top/Center.
Good luck with it.
Hey:) I know it's old but I found it very useful - can't "cut it" to the part of screen (I've got buttons and logo and those credits go right through them). Could you please help?
I have updated the example above with a RECT that will define the position and size of the credits area.
I'm using your script as a simple way to implement credits in a sample game for others to use for free. However, I'm unable to line up the position rectangle so the text appears below the screen and moves upward until the game detects the text has moved above the screen. I'm specifically trying to make it work out of fullscreen. I'll explain that later in this post.
The only thing I've done to your script is make the viewArea Rect object into a private object and give it the dimensions of: new Rect(0, 0, Screen.width, Screen.height)
I assumed the Screen.height would allow the offset to be placed at the bottom of screen, as Screen.height is the height of the screen in pixels. The value is the lowest value in the y-axis in fullscreen. However, this value does not work outside of fullscreen, and I have yet to find a way to make the credits work outside of fullscreen mode.
TL;DR: Do you happen to know of any way to make your credits script work while the game is windowed?
@Rxanadu The solution you're describing works for me. I added these lines of code to the beginning of the Start method, before the initial offset is set:
if (this.viewArea.width == 0.0f)
{
this.viewArea = new Rect(0.0f, 0.0f, Screen.width, Screen.height);
}
I tested by building a standalone Windows build and switching between fullscreen and windowed using Shift+Alt+Enter while it was running. Does it work for you in fullscreen? If so it should also work in windowed. The width and height of the Screen class actually refers to the boundaries of the game screen and not the whole desktop.
It does indeed seem to work. I've tend to test everything out in the editor before building it, so it tends to look odd when testing the game.
Thanks for the help.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Customizing GUI buttons 1 Answer
ignore left mouse button click in game when clicking on gui buttons 1 Answer
GUI Button to a GUI slider help ? 0 Answers
How To Make GUI Buttons Load/Quit 1 Answer