Announcement

Collapse
No announcement yet.

setting visibility of a widget from another widgets button?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Originally posted by invayne View Post
    binding isnt working either i just keep getting duplicate menus so i decided to just take the buttons out and go with keybinds. would have liked to have given that option to players but i cant seem to stop the duplicate windows from appearing no matter how i set it up. worse part is that one of them acts as a inventory while the other is just a blank duplicate. now for the head ache of trying to implement drag and drop with umg. thanks Xendran for the ideas and help!
    But if you are getting a duplicate of your inventory must be because you are creating another widget from the same class.

    Also, in your pictures you are not showing us the place you are creating the widgets from. If you are getting two widgets of the same is because you have set both variables as the same widget reference.
    Plus, I'd recommend you not creating the widgets and then just set their visibility on/off, because when they are hidden they are still using up memory space. It is better to create the widget in the button press itself and use Remove from Parent node in the next button press to remove it.

    Comment


      #17
      yeah but wouldnt that wipe my inventory of all its items? cause i was thinking the same thing but i was afraid it would wipe my items all together. and at this point i already have the widget set up to have everything go through one widget. meaning no child widgets except my slots. also the widget it self gets created once. unless switching between levels would cause teh same effect if i am creating the widget in the character blueprint

      Comment


        #18
        hate to even think about commenting on this but...

        1) those N flip/flops expect to actually flip then flop you can't control them from another BP. and I don't see where you are setting the focus to the widget only to do so (I don't think you need to use them like that, probably best to dump them)
        2) you have 2 Boolean values in your BPs -> Inventory Active & Menu Open but you don't show where you are using them to actually control flow of what is shown & when
        3) you don't show where you set those (blue) Menu Objects, just creating a variable of that class doesn't necessarily do anything if you don't set them
        4) you need to show where you actually use Create Widget and create the widget & where you set the widget objects at

        From what little I can see you have actually created 2 different widgets somewhere and expect them to act like one.
        Post ScreenShots of where you create & set the widget objects & also show where you set and use those variables.
        And explain how you expect those Booleans to control flow if you aren't using them

        on a side note: I really like your graphics & setup of your Inventory & UI -> looks really good!

        Comment


          #19
          ayretek the inventory i self is done by the new ue4 tutorial i just did exactly what they did. the way they do it is the inventory active bool is set to the enabled bind on the vertical box that houses the inventory with enabled unchecked. the inventory it self is set to hidden. in the my character blueprint following the tut they do a event begin play and create the widget there and do a key bind there as well to hide / show the inventory. all inventory mechanics are set up in the widget blueprint. the menu open bools are there for when i add in a cross hair there for later use to when i add in the cross hairs i can say wither or not to show the cross hairs. the "blue Menu" objects are all set up in the inventory widget i.e. ( to call the panel to make visible you have to get your inventory widget then get the inventory panel in order to set its visibility.) so even though im only creating the widget once its still duplicating when i hide/show it with a different button other than the keypress

          sidenote: thanks


          this series here https://docs.unrealengine.com/latest...GSH8gxaA7a_zCt
          Last edited by invayne; 12-16-2014, 10:59 AM.

          Comment


            #20
            k, thought I would try to help, but that's a 2 hour tutorial and I like helping people etc. but I'm not going thru that tutorial right now and if you have followed the tutorial why doesn't your BP work?

            again I haven't followed or done the tutorial
            but what my point was that you need to look & follow your flow thru your BPs, if you are trying to control that one widget from 2 different BPs or places you need to have complete control.
            use a control Boolean that both places can access not a local one unless you completely control it's use.
            another words when you go into that inventory it needs focus & control over that key press and the click, you can't do them separately without the one knowing what the other is doing there is a lot of ways to set up widgets & use them but you can't just throw it all together & expect it to work either.
            you need to look at this if you are creating your own widget & using it with that tutorial
            https://docs.unrealengine.com/latest...ets/index.html

            that's not a visibility problem you have there, you have 2 separate instances of the same widget
            Last edited by ayretek; 12-16-2014, 11:53 AM.

            Comment


              #21
              so basically i just need to set up another branch to check for visibility is what your saying. and i dont see how im making 2 instances of the same widget when the inventory widget is only created once. there is no 2nd create widget. not to mention the hud and inventory panel are all part of the same widget so thet would mean i would be creating the hud 2 times but im not. thats why i have it set up the way i do exactly the same since the widget it self is only created 1 time and im only setting a vertical box inside that widget visible or hidden. so from all of this can you tell me how im creating 2 instances if the widget it self is only created one time?

              also my blueprint works fine this is and addition im doing with adding in the button this was not part of the tutorial and ive made many buttons before and never had this issues


              dont get me wrong i do appreciate the help.
              Last edited by invayne; 12-16-2014, 12:23 PM.

              Comment


                #22
                Originally posted by invayne View Post
                yeah but wouldnt that wipe my inventory of all its items? cause i was thinking the same thing but i was afraid it would wipe my items all together. and at this point i already have the widget set up to have everything go through one widget. meaning no child widgets except my slots. also the widget it self gets created once. unless switching between levels would cause teh same effect if i am creating the widget in the character blueprint
                It wouldn't wipe them. You need to have an array with all the items in your character blueprint, so everytime the widget is called, it updates what each slot of your menu has. And yes, going from map to map is going to reset your widget anyways (at least as far as I know), so you better keep a track of what's in that menu. If that menu shows the skills you have currently equipped, you want to access your main character's array of equipped skills and display them in the menu you create.

                I don't know if I'm explaining myself properly.

                Comment


                  #23
                  np, and believe it or not, I'm really trying to help.

                  I hope I'm not confusing you more but what I'm trying to put across is you are calling it twice so guess what -> it shows it twice
                  that flip flop is getting cut on when you press &/or click then you are expecting the other to cut it back off & that's not how it works. (so you have two widgets showing from the same one you first created via the objects you keep calling.) but to keep it simple just ignore what's in the parenthesis for the moment. you are flipping those flip flops and now they are stuck waiting on you to flop them back off again, hope that makes sense. (ie: you cut them on now they are waiting on you to cut them off before they do anything else)

                  if you insist on using the key command & the click, then they have to know what the other is doing, use a control variable of some type ( probably a Boolean is best) that both BPs know about and can access, probably best to do this from your character BP (Sora I'm guessing it is)
                  ie: I am open (whether it's a click or a key event) and I'll close when you hit the event again (either click or key) but that event needs to know that the widget is already in use so it can close it, just like it needs to know if it's not showing to start with so it can open it.

                  Edit for clarity: if you do try to use both key & click events, separate the A & B parts and use the control's True & False to open & close your inventory

                  Another possible & maybe even cleaner approach (worth trying):
                  is to use the clicked event in widget to call that original call_Inventory event (or you may have to create a new event) in your Sora BP
                  (in widget: get player character -> cast to Sora (BP) pull off of blue pin & access the event in Sora)
                  (from the little I can see in your screenshot you should be able to plug both events into the branch)

                  don't forget you can always use a PrintString to see if these things are working or not & how /when they are working as well. don't be scared to use them, easy way to see where your flow is going and even if it's working.
                  Last edited by ayretek; 12-16-2014, 02:04 PM.

                  Comment


                    #24
                    ok so after a large amount of testing and talking with another blueprint scripter we came to the conclusion that ue4 is broke. but really not the case. so to clear things up so people can simplfy there stuff with out all the extra hard ships. you can infact make a simple set up like i have with just the set visible nodes if your trying to hide /show a menu they will work in conjunction with other key binds seeing how the set visible node actually does all the checking you need as long as you give it a target. with that being said if you want to do less nodes doing a visibility bind can be used just to cut 1 extra node out on the widget it self...


                    now for what the actual cause of the issues with the menus and why its duplicating. the duplication is caused by basically switching levels. for my testing i was going from the mainmenu to the new level which in turn recreates the widget 2 times. this is because the create widget is in the character blueprint as the ue4 tutorial said to do. which is fine its still doable. so in order to fix this issue you have to do the following...


                    if your using the ue4 tuts on inventory system you can do as he says and create your widget and add it to viewport in your character blueprint. i also found that this is the only way to receive and key inputs on it. no idea why and trust me i tried every thing.

                    so first if you have a main menu that opens a new level then to avoid the duplicate menus on your inventory you have to just remove it from parent. so from the new game button or what ever you called it just cast to your player grab the inventory variable in your character blueprint and just plug it in to the target on remove from parent. other wise you will end up with duplicate widgets. so for each new level you have to go to you will have to do the same process each time. I believe you will need to auto save your variables before you load a level and load them when you open the level in order to not lose any information in your arrays i have not tested this yet but will when im done with the rest of the inventory system.

                    once again thanks again for all who posted tips and such!
                    Last edited by invayne; 12-17-2014, 08:09 AM.

                    Comment


                      #25
                      glad you got this working for you & fixed

                      but in all that information, you left out the fact that you were changing levels. (or I am blind as a bat)
                      either way, this should have been the first thing you mentioned not the last, just in case you ever have any future problems.

                      again, glad you got it working, again, it looks great, and good luck

                      Comment


                        #26
                        Originally posted by ayretek View Post
                        glad you got this working for you & fixed

                        but in all that information, you left out the fact that you were changing levels. (or I am blind as a bat)
                        either way, this should have been the first thing you mentioned not the last, just in case you ever have any future problems.

                        again, glad you got it working, again, it looks great, and good luck
                        in all honesty it didnt really hit me till about 11 last night that the level switching might be the problem but was to tired to test so tested it this morning and that was the case and i did mention switching levels when i asked keytotruth a question ( "yeah but wouldnt that wipe my inventory of all its items? cause i was thinking the same thing but i was afraid it would wipe my items all together. and at this point i already have the widget set up to have everything go through one widget. meaning no child widgets except my slots. also the widget it self gets created once. unless switching between levels would cause teh same effect if i am creating the widget in the character blueprint" ) But even then it really didnt hit me to try removing it from viewport. Its one of those stupid things that kinda just fly over your head while your ripping your hair out over something slapping you in the face going im right here you idiot remove me!

                        Comment

                        Working...
                        X