Search Unity

Game Jam Menu Template Q&A

Discussion in 'Community Learning & Teaching' started by Matthew-Schell, Jul 15, 2015.

  1. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238
    This is the official forum thread for the Game Jam Menu Template asset, found here:

    Asset Store Link:
    https://www.assetstore.unity3d.com/en/#!/content/40465

    If you have questions please look first at the video here:

    Live Training Archive:
    https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/game-jam-template

    The first ten minutes shows how to add the asset to your project and details the options. The rest of the video walks through the scripts and the detailed implementation.
     
    theANMATOR2b likes this.
  2. 10XL

    10XL

    Joined:
    Mar 7, 2015
    Posts:
    1
    I am trying to get a 'quit to main menu' option working. Instead of doing QuitApplication.Quit(), I am destroying the UI object and loading the menu scene. Now when the menu scene is loaded from 'PausePanel', the start button isn't changing scenes. What confuses me is that the scene changes if some other button is pressed before or after I press start.
    Here is the code I am using for the 'OptionsQuitToMenu' button in 'PausePanel'.
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class DontDestroy : MonoBehaviour {
    6.  
    7.     public static DontDestroy ui;
    8.    
    9.     void Awake() {
    10.         if(ui == null){
    11.             DontDestroyOnLoad(gameObject);
    12.             ui = this;
    13.         } else if(ui != this) {
    14.             Destroy(gameObject);
    15.         }
    16.     }
    17.     public void GoToMain ()
    18.     {
    19.         Destroy (this.gameObject);
    20.         Application.LoadLevel (0);
    21.     }
    22.  
    23.     /*
    24.     void Start()
    25.     {
    26.         //Causes UI object not to be destroyed when loading a new scene. If you want it to be destroyed, destroy it manually via script.
    27.         DontDestroyOnLoad(this.gameObject);
    28.     }
    29. */
    30. }
    31.  
    32.  
     
  3. Kajaman13

    Kajaman13

    Joined:
    Jul 28, 2015
    Posts:
    4
    If I:
    - add the prefabs into an empty scene
    - click run
    - click Options button
    - disturb the volume sliders in any way

    the sliders always slide all the way down from that moment on. Even if I try to move the sliders up, the moment I stop moving the mouse they go down again.

    I'm using the 1.04 version on unity 5.1.2.

    Any ideas what could be wrong?
     
  4. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238
    Your code looks OK to me. What I would personally do here is instead of destroying the UI make scene 0 a pre-scene that contains the UI (and any other manager objects) that you never reload. Then make your menu scene 1 and reload that and re-enable the UI to the state you want.
     
  5. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238
    Hmm that's weird I am not seeing that behavior on my end. It's the first I've heard of it. Does it do the same in the Pause menu?
     
  6. vladimirdlc

    vladimirdlc

    Joined:
    Jan 26, 2013
    Posts:
    19
    It's possible to work with several scenes with this template? How could we do the transition from scene 1 to scene 2 and then any other keeping the menu?
     
  7. afonseca

    afonseca

    Joined:
    Feb 28, 2012
    Posts:
    80
    I just watched the video and tried out this template, very nice. I did run into an issue with the transition between scenes. It looks like something is strange and it's a bit hard to describe so here's a short video of what happens when you set it to change scenes:



    Did something break?
     
  8. jaymacibe

    jaymacibe

    Joined:
    Oct 11, 2015
    Posts:
    3
    Hi I keep getting this exception when I press start.
    "UnassignedReferenceException: The variable fadeColorAnimationClip of StartOptions has not been assigned."
    "You probably need to assign the fadeColorAnimationClip variable of the StartOptions script in the inspector."

    I can't assign it because the script says to hide it in inspector. It won't even let me change scenes.

    Also the fade animation will loop before I even press start. Can't find what is causing that.
     
    Last edited: Oct 16, 2015
  9. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238
    hey,

    This problem is related to a recent bug in Unity. Grab the latest patch release (patch4) from this page:

    https://unity3d.com/unity/qa/patch-releases

    It should be fixed there. The garbage text being displayed was an issue related to having the Image set to None. In that version adding a blank image would fix, but I think in the patch they've solved it.
     
  10. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238
    Yes you can. You will need to write your own logic to transition from one scene to another (look at Application.LoadLevel). The menu however is set to 'DontDestroyOnLoad' so will persist between scenes unless you destroy it yourself via script.
     
  11. Matthew-Schell

    Matthew-Schell

    Joined:
    Oct 1, 2014
    Posts:
    238
    That clip should be set in the prefab, if you need to re-set it or change it you can just delete the [HideInInspector] attribute from the script. It will appear in the editor and you can drag in the animation you want to use. HideInInspector is just used to tidy up the script and make it less confusing, it doesn't change the way the script works. The animation you need is in the Animation folder. Maybe you didn't import the whole package and so it wasn't there? Not sure, it works on my end as intended.
     
  12. DYV

    DYV

    Joined:
    Aug 10, 2015
    Posts:
    58
    This is just my case, I added LoadLevel buttons with Load OnClick script using "Creating a Scene Selection Menu" tutorial but I can't hide menu and change music when new level is loaded.
    Matthew, could you give us a bit more information about it? How one can destroy menu between scenes via script?
    I really like your template and would not want to give it up:)
     
    Last edited: Oct 24, 2015
  13. afonseca

    afonseca

    Joined:
    Feb 28, 2012
    Posts:
    80
    Thanks, that fixed it for me. It looks like the same issue was present in the button backgrounds as well since they now draw similar to what the tutorial video showed.
     
    Matthew-Schell likes this.
  14. DYV

    DYV

    Joined:
    Aug 10, 2015
    Posts:
    58
    well, I realised how to do it by myself:)
    Thanks again for the good template.
     
    Matthew-Schell likes this.
  15. jbenjamindaleb

    jbenjamindaleb

    Joined:
    Feb 14, 2016
    Posts:
    1
    Hi.

    I can't seem to get the pause menu to appear once the second scene has loaded, do you have any idea what the problem may be?
     
  16. wasialam

    wasialam

    Joined:
    Jan 31, 2016
    Posts:
    2
    Hi,
    I have a little problem on the options menu. I have load this UI in scene 0 and my game is in scene 1. When I am in scene 0 this Music volume works perfectly but after the play (from scene 1 to scene 0) my volume become max and i cant not increase it again (as its already the max).
    Rest is working great, thanks for the UI anyways.
     
  17. wasialam

    wasialam

    Joined:
    Jan 31, 2016
    Posts:
    2
    Hi, I am able to solve my problem.
    The problem was because of the multiple UI objects. When i move from scene 1 to 0 it creates new instance of UI.
    To solve this i replaced the code of DontDestory script with:

    private static GameObject instRef;

    void Awake()
    {
    if (instRef == null) {
    instRef = this.gameObject;
    DontDestroyOnLoad (instRef);
    }
    else
    DestroyImmediate (this.gameObject);
    }
    Now its working fine.

    Thanks
     
    Matthew-Schell likes this.
  18. unity_ssRlDRCUR0GvzQ

    unity_ssRlDRCUR0GvzQ

    Joined:
    Jan 26, 2018
    Posts:
    1
    In need of some help, I am a beginner with unity. I downloaded the game jam menu asset package to my single scene game, and cannot get any of the buttons for the UI to work. When clicked on, they just highlight and do not fade, or seem to be active at all. Again, there is no scene transfer so the start options script is set to 0, and change scene is unchecked. I cannot figure out what to do in order to get these buttons working. Can anyone help?
     
  19. Erenquin

    Erenquin

    Joined:
    Apr 9, 2018
    Posts:
    164
  20. vandale_

    vandale_

    Joined:
    Aug 16, 2019
    Posts:
    3
  21. Erenquin

    Erenquin

    Joined:
    Apr 9, 2018
    Posts:
    164
    Hello,
    well that's quite a long time ago :), I do not remember.

    I just reopened the project with Unity 2019.3, and it loaded and ran.
    But maybe I stopped at the very beginning or skipped some parts. Not sure.