I have built quite a reasonable game so far, but cannot come to terms with the New UI. Would some kind forum member be prepared to show me in pictures, how to go about placing the ORK Sample UI Prefabs in the Framework.

I have read all of the literature provided on this subject, but still I am puzzled in it's use.

Many Thanks
Ozzie
  • edited June 2016
    Let me try without pictures first and then tell me if you still need pictures.

    Import the New GUI file from the tutorial here. It comes with 6 prefabs: Button, Content Box, InputField (for allowing the player to type in text for example), Slider, Toggle and Vertical Scrollbar.

    To use them in the Framework, you use Guiboxes that you set up in the Menus. For example, I have a Guibox called Big Dialogue which is used by my npc's to show their speech.

    Your Guibox has different sections---the Content Box and Name Boxes and everything else is just as it was in Legacy Gui but you have slots to slide in or select the appropriate New GUI prefabs.

    In Content Box Prefab, slide in the Cnntent Box prefab, for the Name Box Prefab, slide in the Content Box Prefab, for the Button and Tab Settings, slide in the Button Prefab. For the Scrollbar Prefab, slide in the Vertical Scrollbar prefab. For Value Input Settings, slide in the Inputfield prefab. For the Toggle input use the Toggle prefab and for Slider use the Slider prefab.

    And you have to fill in the usual font and colors for text and whatever boxes need to be checked.

    The result will be a transparent box with buttons and the text should show up where it's supposed to.

    If you want to use an image of your own--for example a black background box for the Content box prefab or a colorful image for the buttons, you have to change the type of your image to "Sprite (2D and UI)". Then duplicate the Content Box prefab or Button Prefab or whatever prefab you want to use so you can still use the supplied prefabs if you want to. Call the duplicate something easy to remember like Black Content Box or Brown Content Box or whatever.

    In your project, click on your new Content Box whatever you called it so you can see the contents and settings in the Inspector---you'll see the top has settings for size of the object--for a button you might give it a height of 80 and a width of 100. Leave everything else alone but if you are using a big image that you want to scale across the screen you might want to change the scale.

    You can click on the anchors there to position the image in relation to the prefab. Do you want the content to be centered? Etc.

    Where you see the Image Script you see a choice of Source Image--whatever image of your own--like a colorful box for a button--you want to use---slide it in there or select it.

    Remember you have to make your image a Sprite (2d or UI) type first. Image type should be Simple unless you're using a Sliced image. I usually leave Raycast Target and Fill Center checked.

    That's about it for the GUI Boxes.

    If you want to use an image in the screen Canvas---for example you want to make a background for a Main Menu scene----

    Go to the top Unity toolbar in the scene--choose Game Object--UI--Image and you'll add an image on a canvas to the screen--remove the event part of the canvas if it's the Main Menu as ORK will add its own event.

    Click on the Image part of the Canvas and look at the Inspector---there's a place to slide in the image you want to use. You can adjust the position of the image, its size. If you want it to scale with the screen monitor or mobile screen size--go up to the Canvas and check Scale with Screensize in the Canvas Scaler script dropdown.

    If you need more information or pictures, just ask. Not sure how much this helps you. If you still need the pictures, it would be easier for me to do that on Skype--pm me and I'll let you know my skype.









    Post edited by Catacomber on
  • Thanks Catacomber, got it, with your help. Once I understood the process it was easy.

    Many Thanks
Sign In or Register to comment.