edited March 2016 in ORK Support
Simple Health Bar - new GUI

How can I create a very basic UGUI Health Bar with the new Unity UI (inside the Ork Editor)? Is this possible? Is it easier accomplished by attaching an ORK component to the Game object and allow ORK to control the health values that way? If so could someone please explain the process in detail? Even better a post with an example file I can dissect would be great. In fact I’ll post a tutorial on this thread with pictures for newcomers like me. I’ve scoured through the many forum posts and tutorials but to no avail. Actually I found a few different ways to do it but not helpful explanations. It’s my understanding that ORK Framework handles this inside the editor. In my personal opinion it’s pointless to use another visual editor for uGUI since Unity already has a way to create the UI in a visual manner. It’s really not as simple as drag and dropping the correct prefab into the Content Box or Name Box settings.
We need in depth tutorials changing the Legacy GUI to the New GUI.
image
Thanks for this. New GUI Tutorial I’ve got all the correct settings hooked up. I even got a decent menu working with UGUI and Ork but I’m not asking for a Menu. Your example file only has a few prefabs uGUI gameobjetcs. Can we get an example file with the process in action?

Here’s my Setup.

Under Menus/GUI Boxes add “Player HUD”. Auto Adjusted/Uses Own GUI Skins. I’ve placed prefabs in all the slots just to see if something would happen. I made sure the box is visible in the GUI Editor.
image
Under Menus/HUD add “Player HUD.” The display conditions are as follows. I’ve added a Status Element and a link to the Status Value Type Combatants Consumable.
image
There is no option to add a custom health bar prefab only a “Use Bar” box which I assume is linked to Legacy. What am I doing wrong?
Post edited by necco on
  • These are my Default Combatant Choice Layout settings. I’m sure that this UGUI player HUD nonsense is already covered in a tutorial or forum post. If you can point me in the right direction…
    image
    It seems like the New Game Main menu is built into the framework so there is no need to manually add an event to show it in the first scene of a game. But anything other than the first scene needs an event set up to show the UGUI content. Following the simple Dialogue tutorial went fine. My UGUI content shows thanks to the event that forces ORK to show it on the screen. But for the player HUD assembly there are no event driven states in the UI MENU that allow me display the players HUD.
  • edited March 2016
    There are very specific settings that need to be outlined. I need just a small sample file with some UGUI content.
    Post edited by necco on
  • Adding a custom health bar can done either through Status>Status Values>Display Settings>Default Value Bar>Value Bar 0>Use Image or Override Bar>Value Bar 0>Use Image which is two fields below the "Use Bar" as you described
  • HUDs use the default bar settings defined in the displayed status value (as @Raiulyn said, in Status > Status Values in their Display Settings). The HUD can optionally override the bar using the Override Bar setting).

    The value bar can either use a color or an image, and use alpha masks. You can also use the Crop Image setting to only display the part of the image based on the bar's value (e.g. 50 % filled displays 50 % of the image).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Please understand that the process you both just described through (Status>Status Values>Display Settings>Default Value Bar>Value Bar 0>Use Image) uses an image texture and not the UGUI.
    ORK handles the way the bar is displayed but there should be an option here to add a UGUI prefab with my sprites. In other words a custom UGUI Bar has to be integrated with ORK in a different way. How?
  • edited March 2016
    image
    As you can see I have a simple Atlas inside Unity. The Atlas Texture settings are on Sprite (2d and UI) Sprite mode is Multiple. The only purpose of using an atlas it to reduce set pass calls on Mobile devices. It makes for fast performance and less work on the CPU ECT. When I try to drag and drop my Health Bar HP sprite that is inside the Atlas it won’t work obviously because Ork needs a texture.
    image
    When I drag and drop my HP bar textured image it works. But the issue is that I don’t want to use a single image texture. Doing it this way Unity for some reason is not batching my images together and using multiple set pass calls. It’s a win lose situation. The entire point of using the UGUI, the new Unity GUI is performance.

    If this is not supported by ORK Frame work please don’t point out the obvious. What other ways could I accomplish the task of using a simple Health Bar in the UGUI hooked up to a combatants stat HP value and allow ORK to manage those values through an event maybe?
    Post edited by necco on
  • edited March 2016
    "If this is not supported by ORK Frame work please don’t point out the obvious." ...Fine then.

    What you want to do it set up your HUD via the editor in Unity as you normally would with Unity's new system, then write a custom script to control the size of those bars yourself, using ORK's API. You can get when those values are changed via api events, rather than having to query the system every frame.

    First grab your combatant component for your player in a start function,
    combatant = GameObject.FindWithTag("Player").GetComponent<CombatantComponent>().combatant;
    then register the status changes
    combatant.Status[2].Changed += StatusValueChanged;
    In this case, [2] is the index of my HP value.
    Then handle the art in a separate function.
    	
    public void StatusValueChanged(Combatant combatant, int id, int change){
    //change your bar here, either via mapping values or simple scaling or whatever.
    }
    Then write either another script to control when your HUD is displayed or use ORK's event system to do that.

    If you ever destroy your hud (like during a scene change or whatever), deregister from the event.
    	
    void OnDestroy(){
    combatant.Status[2].Changed -= StatusValueChanged;
    }
    Post edited by Firrerreo on
    My little chunk of the internet: http://artemic.com
  • Firrerreo your explanation speaks volumes. Thank you! Although I have to admit my ulterior motive. As a designer I’m willing to pay $12 in order to avoid scripting of any kind. Hence Playmaker Actions for ORK was born and thank goodness. I needed a coder to present the logic that I could translate into Playmaker and work with ORK. Once I am finished dissecting your script I will post a simple tutorial but it will take a few days to get it right.

    Actually I just got a reply back from the admin over a gamekakkak.com. Here is the post. simple Health Bar UGUI and Playmaker

    ADMIN reply
    "You should download UGui Playmaker Add-ons here Unity UI
    Playmaker Add-ons. Then use ORK_Status Value To Variable for convert status data to FSM Variable and using in UGui."

    image
    He pointed me in the right direction. I'm going to try this a bit later today, but I can already foresee a few problems.
Sign In or Register to comment.