Author Topic: Scrolling Credits Scene  (Read 8201 times)

Fido77

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Scrolling Credits Scene
« on: October 17, 2013, 10:23:15 AM »
How can a scrolling credits scene be made with NGUI? I have been searching the forums to see if there was anything on how to do this, but I haven't been able to locate anything. Can it be done?

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Re: Scrolling Credits Scene
« Reply #1 on: October 17, 2013, 03:06:17 PM »
Do you mean automatic scrolling like in most games/movies or do you mean that the Credit-Screen itself can be scrolled via Touchinput.   

For the first one (one method off millions, I guess):

- make one NGUI-Label for the whole Credits or for every Name/Word a single Label
- create an empty GameObject -> make this Object the parent of the labels
- attach a script to the GameObject where you move it constantly up/down/whatever


For the other one you could create a Scroll-View-Panel. In fact, you could make the first one a Panel, too. So you could use Clipping (Soft Clipping) which would look nicer.

Long answer short: yes, it is possible.

Darkmax

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 93
    • View Profile
Re: Scrolling Credits Scene
« Reply #2 on: October 17, 2013, 03:25:41 PM »
to move the label you can use Tween Position

Fido77

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Scrolling Credits Scene
« Reply #3 on: October 17, 2013, 07:32:19 PM »
Do you mean automatic scrolling like in most games/movies or do you mean that the Credit-Screen itself can be scrolled via Touchinput.   

For the first one (one method off millions, I guess):

- make one NGUI-Label for the whole Credits or for every Name/Word a single Label
- create an empty GameObject -> make this Object the parent of the labels
- attach a script to the GameObject where you move it constantly up/down/whatever


For the other one you could create a Scroll-View-Panel. In fact, you could make the first one a Panel, too. So you could use Clipping (Soft Clipping) which would look nicer.

Long answer short: yes, it is possible.

Yes. I was talking about the first one. Can it be done by making a JPEG of the list of credits (this is the best way I can think of to get other company's logos in) and then set the JPEG in NGUI and have it scroll up? I haven't had any luck adding in my own images in NGUI so far is why I ask. I'm pretty new to using NGUI, even tho I have had it for a while :p

Darkmax

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 93
    • View Profile
Re: Scrolling Credits Scene
« Reply #4 on: October 17, 2013, 10:59:51 PM »
mm if the image is too big I will recomend use a UITexture a then use Tween Position to scroll the texture, instead of try to add the image to an atlas.

But I think other way to do this (but I'm not sure because I have never tried this) is to use a bitmap font and add emoticons where this are the symbols of the companies that you want to show.

Here is the tutorial for a past version of ngui http://www.youtube.com/watch?v=JbqfK3mU140, but I think this is still possible on the current version.


« Last Edit: October 18, 2013, 11:58:00 AM by Darkmax »

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Re: Scrolling Credits Scene
« Reply #5 on: October 18, 2013, 02:56:36 AM »
Where is the problem to import the JPEGS and use them as NGUI-Sprites?

Fido77

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Scrolling Credits Scene
« Reply #6 on: October 18, 2013, 11:02:34 PM »
I found a solution that seems to work. I created a plain and added the JPEG's to the plain. I set up the 2D camera in front of the Plain. Added a quit button at the bottom so the player can quit the game after the credits scroll through. All I need to do now is add a script to the camera to make it start at a y position at the top of the plain, and  change the y position over time to create a scrolling effect and stop at the bottom of the plain. Or change the y position of the plain to create the same effect. I think moving the camera will be the best approach.

Fido77

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Scrolling Credits Scene
« Reply #7 on: October 18, 2013, 11:29:12 PM »
Where is the problem to import the JPEGS and use them as NGUI-Sprites?

I'm not sure how to import the JPEGS as NGUI Sprites. Every time I try to use my own images in NGUI it fails. I ended up creating the credits list in WORD, saving as PDF, and then converting the PDF to JPEG, which ended up being 5 JPEG images. May not be the best method out there, but it looks pretty good to me :)

bariscigal

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Scrolling Credits Scene
« Reply #8 on: September 23, 2014, 02:40:36 PM »
Created a quick solution for this type of credits and wanted to share.
Create a scroll view and create a long text of uilabel as a child.
And attach this to your scrollview object.

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class creditsScroller : MonoBehaviour {
  5.         UIScrollView scrollView;
  6.         UIPanel _myPanel;
  7.         public float textMaxOffset = 3500f;//roughly a 100 line of text
  8.         public float scrollSpeed = -1f;//negative speed for text scrolling from down to up
  9.  
  10.         void Start () {
  11.                 scrollView = GetComponent<UIScrollView>();
  12.                 _myPanel = GetComponent<UIPanel>();
  13.         }
  14.  
  15.         void Update () {
  16.                 scrollView.Scroll(Time.deltaTime * scrollSpeed);
  17.                 if(_myPanel.clipOffset.y < -(textMaxOffset)){
  18.                         scrollView.Scroll(0);
  19.                         scrollView.ResetPosition();
  20.                 }
  21.         }
  22. }

This will roll the credits until the text finishes and will start over.