Hi Chris / community,
I wonder if you could please advise? I have a menu called 'Black Bars' that I manually trigger to overlay during cutscenes for a more cinematic look (I saw mention of it in the manual or an AC online tutorial, which gave me the idea). I made a menu that has a 'Graphic' element of a 1920x1080 PNG that has black bars top and bottom.
The black bars show correctly in the Editor, but when I make a Web build, there's a gap underneath the bars that I'd like to fix. The gap seems to disappear when I click into full-screen though.
Do you have any tips to make sure the black bars stay stuck to the top and bottom of the screen, or is there a better way of doing this? My plan was releasing this on itch.io to let it be played in the browser, and hopefully without having to ask players to make it full-screen.
Here's some pics. What it looks like in Web build:
In Editor, looks correct:
My Camera in AC Settings:
And then the Menu settings:
Thank you.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
I feel this might be a quirk of Unity's ImGUI system that powers the "Adventure Creator" Menu source option.
If you switch the Menu over to use Unity UI, you should be able to avoid this. Rather than using a dedicated texture for the bars, you can create a pair of Image components, aligned to the top and bottom, that show a pure black colour.
Thanks Chris. I'm trying to get this to work - creating a Canvas with bars top and bottom by stretching out a square sprite isn't difficult, but I'm struggling to figure out how to resize the Canvas prefab to fit within the game's camera. It seems like when creating a Canvas, it's like 1000x the size of what the game camera is, it's huge! Any idea how to set this up please? I've tried checking 'Always fit within screen' but that doesn't seem to work.


Also, I'm selecting 'UI Prefab', creating the Prefab and then linking it to the Menu.
But just one bar is filling the entire screen when I run the game.
My guess it's the 'RectTransform Boundary' which I'll noodle with next, my experience with Canvas UI is limited.
So, I could get the bars to display correctly by changing 'Rendering Mode' to 'Screen Space - Camera' in the Prefab's inspector. Nice.
The issue I'm having now is, the fades in and out of the bars don't seem to work, and the bars are displaying behind some elements in the scene.
May I ask pls how best to set up so that the black bars fade in and out with how I've set up the actions in the ActionLists for when I call the Menu as the actions have a 'fade' option I've checked - or - maybe I should create new ActionLists to move the bars up or down, by placing 'Moveable' scripts on each bar and animating them?
And also pls how to make sure the bars get drawn on top of everything as they're currently being drawn behind some things.
EDIT: I managed to get the bars to draw on top of everything by changing the 'Order in Layer' of each bar to 10, changing the Canvas Parent order number didn't do anything but this did, nice.
Also edit: Keen to test whether this new Unity UI Black Bars resolves the issue when next I made an HTML5 Web build, ta.
And another q pls - if I can't get the fade to work, I'm trying to get an ActionList to run when the Menu is turned on, so I have the 'ActionList when turn on' enabled, as I'd like to animate each bar moving/animating into shot for cinematic effect.

However, every time I run the game in the Editor, the ActionList seems to lose the connection to the bars (Missing Moveable), presumably because the bars are part of a Canvas in a PreFab. May I ask how to get the ActionList to remember / point to those Game Objects in the PreFab?

So, I got animated black bars in UI Prefab menu to work, but they're not showing up in the Web build. Hmm, darn.
How I got them to work in Unity prefab: On each bar I added a 'Moveable' and 'Remember Moveable' component. It didn't seem to matter that the ActionList kept forgetting the name of the 'Top Bar' or 'Bottom Bar' as the 'Constant ID' number was still there, which is prob all that matters.
I'm not sure exactly how the numbers work tbh, but I kept entering numbers and by trial and error into the 'ActionList when turn on' and 'ActionList when turn off' action lists for 'Object > Transform' (it was like -500 to move a bar into the screen and -600 to move it out), I kept fiddling with local space vs world space, seems like World Space worked, got the bars to animate into and out of where I wanted them to.
I had to turn on 'Custom Animation States' setting in 'Transition Type' in the Menu so that the 'ActionList when off' would play, otherwise the black bars just disappeared when the menu turned off, instead of triggering the animate out actions in the actionlist.
Sadly though, the bars don't show up at all in the Web build.
So, currently my choices are 'AC black bars menu that works in Web build but don't quite look right - so close!' or 'UI black bars but that don't show up in Web build'. Going to maybe fiddle more with AC's own Menu as that's so close to working, unless there's something I'm missing that would get the Unity menu to show up in Web build?
Here's how the animated Unity UI black bars look in Editor:

And don't show up in Web build.
I tried adding no animation to the black bars in Unity UI Prefab to see what it'd look like in the Web build export - looks like this, lol. Looks fine in editor, though.
I'm super confused with how this all works, lol. So many variables and discrepancies between Editor and Web Build with the Unity Prefab menu option, seemingly. I wonder what I'm missing here? Any help greatly appreciated.
Ok so I think I figured out something - when I was playing the game in the Editor, I had 'Recording Resolution' enabled, which was showing the Unity Prefab bars ok. But when I chose 16:9, the bars disappeared. The Web build shows whatever the 16:9 setting shows.
Playing more in that, with the AC menu, the 16:10 displays the bars with no gap underneath, it's just that 16:9 that has a gap lol.
So, I can now get the Unity Prefab bars to display correctly in 16:9, and it works well in the Web build.
Going to try figure the best way to animate the bars in and out in Unity UI. Not quite sure best way to do that with the Unity Prefab (moveables?) but gonna experiment.
I tried a bunch of things with the AC menu (2 graphics, a square graphic, changing as many setting combos as I could) but just couldn't get a no-gap solution to work in 16:9.
Add a RectTransform as a child of your Canvas, set to always span the screen, and then add your top/bottom borders as children.
Assign this as your RectTransform boundary, and then attach the Auto-correct UI dimensions component to the root to update the Menu's scale. This will update the Menu's appearance when viewed at an enforced aspect ratio.
Hi Chris, thanks for this.
I've got the bars appearing, they only look correct in 16:9 view in the Game view, but that's ok I think.
I have the Canvas set to 'Screen Space - Camera' which seems to be the only way to get it to appear as intended.
A question please - how would I animate the bars in and out? I have the 'Moveables' component added on each bar, but I'm not sure where/how in space I should move things to. I either get them to move out of shot when I want them to move into shot, or they just end up moving to the middle of the screen.
I'm not sure if the bars' RectTransform alignment is messing up their positions, or if I should even align them to the middle top and middle bottom.
So confused, not quite sure what the control is here to determine the position of the bars.
I'm using ActionLists for the black bars, and linking the actionlists in the 'ActionList when turn on' and 'off' part of the menu.
One other q - is there any other way to try to get AC's own menu to display black bars correctly? It's so close to working perfectly, but just has that gap at the bottom when 16:9. I find AC menus much easier to use than Canvas, which I don't really understand yet.
For a bit more info, eg the top black bar's pivot is in the centre, is aligned to top centre of the RectTransform, and it starts off at Y = 0.5 , but when I want the black bar to animate down in the ActionList, I need to put something like Y = 200.


I think I'm overcomplicating this. Canvas shows the position when dragging the bars up or down. Is maybe not as complicated as I thought, gonna keep noodling.
Hi Chris - I made a PreFab of an empty GameObject and made the black bars children of it, so I could select that PreFab as RectTransform Boundary.
However, the problem I'm now facing is that after the Unity UI black bars is turned off, the game kind of gets stuck and the inventory doesn't appear again, so the player can't do anything, but animation in the background etc. continues.
I've experimented with a couple settings but can't seem to figure out why this might be happening. Almost like the cutscene doesn't know it's ended.
The issue is 'Wait Until Finished' was checked the moveable action in the TurnOff ActionList.
You can set the ActionList to run in the background.
Using a Moveable may work, but the intended way to animate menus as they turn on/off is to rely on a regular Animator, and configure the states as set in the Menu's properties when setting the Transition to Custom Animation.
Hi Chris - thanks. I'm currently using separate ActionLists with moveables for the appear and disappear transition black bar animations, mostly works for the in-browser Web HTML build in Safari and Chrome, but for some reason the start and end transition animation's not working in Firefox. I'll look into using a regular Animator, might work more reliably, thanks.
Hi Chris, sorry to bother. I'm having a hang of a time with these black bars. Seems like they keep changing/sliding around depending on how big the Game window is. Have I set this up correctly? Or maybe I should ask, what's the correct way to set this up so that they appear consistently, please?
Vid of what I mean, showing the black bars disconnecting when I drag the screen outwards, and disappearing when I push the screen inwards. The game is 16:9, and even though it says '16:9 Aspect' in the Game window, I worry they'll appear different depending on what type of screen someone plays on.
https://youtu.be/xvCpATAGPZs
Attach the Auto Correct UI Dimensions component to the root - see the Manual chapter of the same name for details. This component is used to keep UIs consistent when the aspect ratio is forced but the user views in a window that differs.
Thanks Chris. Ah, I thought 'connect to root' meant the root parent like I've done here. Do I just stick the Auto Correct UI Dimensions component to an empty game object in the Hierarchy?
The anchor points aren't correct, though. If the boundary spans the full screen area, they need to span from 0,0 to 1,1
Hi Chris, thanks. I changed that and it works better when I stretch the 'screen' horizontally. I also increased the width of the black bars a bit.
However, when I bring the sides of the Game screen in horizontally, the black bars disappear up the top and bottom of the screen. I included a video to demonstrate:
https://youtu.be/3HfpAc_pU3Y
Is this fixable, so that the black bars always display as intended?
Thanks.
It may be down to your Canvas Scaler component, which is set to Constant Pixel Size mode right now.
Put the animation aside for now, and try Scale With Screen Size mode.
Hi Chris, I'm really trying to break this down to basics, foregoing animation.
I've managed to get a simple UI Canvas rectangle to show up correctly in the scene, but am struggling to transfer that to a PreFab for a menu, plus animations.
I'm not even sure what questions to ask, but I have a couple please if you have the time:
Sorry for the hassle, I managed to break the demo scene and keep reloading and retrying different things, but am getting closer.