#Thread. Someone else might want this in
1 messages · Page 1 of 1 (latest)
Here we go
You are using a canvas panel, which implies you WANT to work in pixel values with discrete scalable anchors (think the health bar in the top left of a zelda game)
If you don't need those aspects, you could just use an overlay panel and work on the PIVOTS instead of the ANCHORS
Ah. No, I do NOT want that. I was under the impression Canvas was the general container to use when you want flexible positioning.
No, Canvas is a heavy-weight widget or laying out alllll the stuff in your game. I beleive Fortnite might only use one canvas panel (the base hud)
That sounds like actual hell to maintain.
Overlay is a lightweight panel that holds any number of children in a "stack"
rendering the lowest item last (thus on top)
This WBP scrolling template - is that contained in a parent widet or have you just added this to the viewport?
I don't think I should have anything overlapping? I WILL have multiple prompts scrolling in a sequence though. I actually haven't figured out how exactly to handle that yet.
Nah this is just in the viewport.
What I recommend first is make a user widget (call it somethign like GameHUD or something) and add THAT to your widget instead of this widget
this will help you understand what's actually happening with widget sizes and layout
How should I handle the animation, then?
Inside the GameHud widget, add your WBP_ScrollTemplate to a cnvas panel inside there
Using an Overlay instead of a Canvas inside the template?
Well, we can handle animation individually - based on what you're doing, you probably want to animate each INSTANCE of a rhythm note
The hierarchy will look somethign like this
GameHud
.Canvas Panel
.. WBP_ScrollTemplate
That way, if you want to control the max height or the padding of the scrolling area for your rhtyhm notes, you can control it on the outer canvas, not the inside of the scrolling template
That one will hold an overlay slot with allll of your rhytm notes
You need your scrolling template to place the button unstances. It will house all of your notes as teh scroll
They're randomly generated. Would I need to pregenerate them all before the level starts, or is there a way to add them to the overlay at runtime in such a way that they can still be animated? This is the part I hadn't figured out yet.
You can add them at runtime
It's not the BEST way to do it, but you're probably prototyping for now
Learning the tools, more like. I have a very robust system for dispatching rhythm events thanks to the folks in audio, and now I need to get aquainted with the widgets well enough to figure out how to do what I need.
(the correct way would be to look into object/widget pooling, but that will be separate work from just getting this up and running)
Oooh yeah that sounds like something for after I'm not struggling with anchors and pivots.
Make a "WBP_RhythmNote" widget next
inside that, place an image in ANOTHER overlay panel. This will be the widget we "animate"
Like, as an instance of this templated class with the slot filled, or as the thing that will go in the slot?
Any widget blueprint CAN be instanced. For now, you can throw an instance inside the WBP_ScrollTemplate overlay slot just to see it
Hmmm. You might have to use a canvas panel for the animation, but I'm not 100% sure. I'll see if I can do an alternative version that doesn't use that since animating the anchors can be be bad for performance
Augh.
At any rate here's the note. That nifty little display is something I already had. I can toggle which button is displayed with an enum variable.
Are the notes themselves interactive? or are they just visually helping you time a button press?
So, in the short term, you can just copy that canvas animation (anchors 0 to 1) to this note widget instead of the outer one nevermind, you should just make one canvas in the scroll template to be slightly better on performance
No, there's a different widget that handles that.
Because this game is local multiplayer, getting widgets to respond to the correct controller input is awful. 5.6 has a local multiplayer bug.
So I don't do that if I can at all avoid it.
All these scroll widgets can be entirely controlled by rhythm event dispatchers so that will be no issue.
If you're not gonna do a material approach, then just leaving the one canvas on the template is probably better. You'll have to pass in a reference to the outer canvas panel to the child rhythm note
and each note can do a tick-based lerp instead of a UMG aniamtion
Does this mean add it inside the WBP_RhythmNote file, or apply it to an instance of Rhythm note inside the scroll widget?
I think that you should have a canvas panel inside your WBP Scroll template. You need to have each note handle its own animation on the event graph using a reference to that canvas panel
(for example, in the rythm note widget, make a function for 'SetParentCanvas' and have the rhythm note cache the reference to that when it is generated
then in the rhythm note's event graph, create an event for an update loop which will do all the linear interpolation for the anchors from 0 to 1 over teh course of X seconds
How does that help over the animation?
Animation on UMG timelines require the canvas panel be in its hierarchy. If you need to animate a property outside the hierachy (for example, up the tree to where the canvas panel is) you cannot use UMG aniamtions
since you don't want to make 30 canvas panels when there are a lot of notes on screen, you ened to pass a reference of the canvas panel DOWN to the notes
you might also be able to get away with jsut doing "SlotAsCanvasSlot" and not have to worry about it now that i think about it
UMG animations are fine for simple cosmetic stuff, but you're doing slightly more game-play related things where you might need to interpolate more precisely
For example, if you "pause" the game, a UMG animation won't be automatically paused 😄
so the note will continue animating
It's pretty easy to make your own custom update loop, making sure to pass in delta time to accoutn for frame pacing
I gotta run soon, but I can come back to this thread and offer help if you're still here