Hello Guest

Author Topic: Creating a main menu  (Read 3593 times)

g0tNoodles

  • Newbie
  • *
  • Posts: 3
    • View Profile
Creating a main menu
« on: December 11, 2013, 03:32:50 pm »
Hello, I would like to use this to create a 2D main menu for my game. One reason I purchased this was because it is for 2D and I always have trouble scaling my menus for different resolution, along with finding it long-winded at times.

Is there something built in to this kit to allow this to happen without me really having to code anything? I have already tried using 3D objects to make my menu and while it works okay, it's not great. I would like something that auto-scales with the resolution.

Cheers

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Creating a main menu
« Reply #1 on: December 11, 2013, 10:47:08 pm »
You can drop a few button prefabs in there, sure. You can use the "Send Message" mechanism to call your code. Check out demo #2 - UI layout demo, the "Next" button in there is hooked up using this mechanism. You can use the tk2dCamera + anchors to fit your UI to different screen resolutions.

g0tNoodles

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Creating a main menu
« Reply #2 on: December 13, 2013, 01:52:01 am »
Okay, thanks.

One more question. I am using a slider to let the player control the volume of the game. The workaround I have done is not very nice and I have had to change code in the actual scrollbar script to make it work (using player prefs to set it to the right position on the bar when the player restarts the game). Also, the slider is able to be clicked anywhere on it and the bar will move to that amount, that's fine; however, it seems to be one click behind. I click it at 70% it does not move. I then proceed to click it at 30%, it moves to the 70% position.

Any chance of helping me use the slider and my own script to access the "percent" variable to allow the user to control the volume and to make sure that when the game reloads, the slider tab (and fill bar) are loaded at the correct position? I assume it is very easy but I just cannot seem to work it out!  :-[ :o

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Creating a main menu
« Reply #3 on: December 13, 2013, 11:00:49 am »
There isn't a way to hook that up automatically. It would require reflection to do that and that isn't fully supported on all unity platforms.