Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

C# How to Code an Ending Sequence

Discussion in 'Scripting' started by PWNERX, Jun 3, 2014.

  1. PWNERX

    PWNERX

    Joined:
    Dec 17, 2013
    Posts:
    5
    In my Unity Project, I need to be able to code three things: activating an exit after acquiring all the item pick ups, displaying a message telling you to reach the exit, and being able to show a simple ending text screen at the exit location. I have absolutely no idea how to code these things...and I can't seem to find some examples anywhere.
     
    Last edited: Jun 3, 2014
  2. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    have you looked into unity's gui?
     
  3. laurelhach

    laurelhach

    Joined:
    Dec 1, 2013
    Posts:
    229
    If you go there :
    http://www.burgzergarcade.com/hack-slash-rpg-unity3d-game-engine-tutorial
    You should be able to find what you're asking for for at least the inventory.
    There is an excellent tutorial to start a rpg game.

    By the time you understand all the concepts , activating an exit and printing a text on screen will be easy.
    To Show text you can use GUIText or GUI.Label.

    Good luck in your research!
     
  4. PWNERX

    PWNERX

    Joined:
    Dec 17, 2013
    Posts:
    5
    Well, this is a first person exploration and platforming based game. Which of these Tutorials would point me in the right direction? Also, I already understand how to make a GUI text screen, just not a text pop up.
     
    Last edited: Jun 4, 2014
  5. laurelhach

    laurelhach

    Joined:
    Dec 1, 2013
    Posts:
    229
    You don't know how to code, these tutorials are to explain you how to do inventory, pick up items, display information on screen. You have GUI information, inventory management, etc. It would help you understand and code. Having a first person or third person doesn't change the way you code.

    If you think it won't help you, you can still look at the Unity documentation for the GUI.
     
  6. PWNERX

    PWNERX

    Joined:
    Dec 17, 2013
    Posts:
    5
    I would just like to know where this information is in the Tutorials.
     
  7. PWNERX

    PWNERX

    Joined:
    Dec 17, 2013
    Posts:
    5
    These tuts didn't help.
     
  8. laurelhach

    laurelhach

    Joined:
    Dec 1, 2013
    Posts:
    229
    Sorry then. Hope someone else can help you.
     
  9. zDemonhunter99

    zDemonhunter99

    Joined:
    Apr 23, 2014
    Posts:
    478
    Have you tired using Unity's Scripting documentation? There is such a vast of amount of data in the scripting API that all other tutorials are pretty redundant in my opinion.
    http://docs.unity3d.com/ScriptReference

    This is a fairly simple concept and I shall explain it briefly. You can use the Unity reference to search up the terms that I have used. For the first person controller, you can import the "Character Controller" package from the Assets within unity and drag the first person controller into the scene.
    Next you can create a script which contains the OnCollisionEnter() function and you can define what happens when the player touches the ball in this script. You can create a Boolean which states whether all the pickups have been collected and if they are, set it to true and trigger a GUI box which tells the player to reach the exit. As for displaying the message, you need to use Unity's GUI on which there are hundreds of tutorials on YouTube, so check them out.
    For activating the exit, you can use the Boolean which we had created above. You'll have to create a method which allows the player to use the exit via the Boolean we have created. When the Boolean is true, call the exit activating method and Voila! Dinner is ready.

    This is kind of a rough idea of what you can do but if you aren't able to understand this, I highly suggest you to watch a ton of tutorials and read the documentation until you have become comfortable with unity. Trust me, that's what I did anyway. ;)
     
    laurelhach likes this.
  10. PWNERX

    PWNERX

    Joined:
    Dec 17, 2013
    Posts:
    5
    Okay that helps.