Creating a Main Menu with Script Canvas

0

It appears that Flow Graph is gone, I mean, I have the removal gem disabled and can't see it so it must have been removed in 1.15, and so making a UI is really hard now.

Can anyone make a tutorial on how to make a simple Main Menu with buttons that allow you to load a level, or exit the game, and using Script Canvas, because their seems to be a big push for Script Canvas but as usual, there is barely any documentation on it, so I have no idea what I'm doing. Annoyingly, I'm having to follow the .lua tutorials from 1.7! (Which even they have deprecated code instructions in them!)

Thanks,

Dan

asked 6 years ago189 views
15 Answers
0
Accepted Answer

@REDACTEDUSER

I've attached the completed graph from the tutorial. It does show disconnecting from an Ebus after it's no longer needed. The quit button will close the editor and standalone .exe! You can go into Console Variables and set ExitOnQuit to False to disable this behavior in the editor I believe.

7334-uicontrol.zip|attachment (34.5 KB)uicontrol.zip Completed Script Canvas graph for ui_basics part 2

Another way to listen for button clicks:

REMOVEDUPLOAD

answered 6 years ago
0

Yeah, I am aware of the example, I kind of get it, but not really. The reason why I was asking for a tutorial, was because I wanted a step-by-step guide showing the entire process. Because I tried using similar code blocks and well, I just get the console warning me with this:

[Warning] (Script Canvas) - Entity Id [13802737740620157576] is not part of the current entity context loaded entities and not an internal node/connection entity. It will be mapped to InvalidEntityId
[Warning] (Script Canvas) - Entity Id [13802737740620157576] is not part of the current entity context loaded entities and not an internal node/connection entity. It will be mapped to InvalidEntityId
[Warning] (Script Canvas) - Entity Id [13802737740620157576] is not part of the current entity context loaded entities and not an internal node/connection entity. It will be mapped to InvalidEntityId

And the buttons don't work, so I don't know what I'm missing!

answered 6 years ago
0

@REDACTEDUSER

Ok, I can put some things together using Script Canvas and the UI Editor.

answered 6 years ago
0

@REDACTEDUSER

The samples project gem has a level called 'UI Main Menu Script Canvas Sample'. That is probably the best place to start learning UI, it has a main menu and options screen, with all the associated UI canvases and Script Canvas graph to look at.

Let me know if there is something this doesn't cover that you would want to see, I might be able to demo that.

answered 6 years ago
0

Thank you.

answered 6 years ago
0

Thank you, I really appreciate this.

I have been able to create the ui and script canvas following the guide. Will you be adding a section on button creation? (I'm not rushing you, just wondering, because your guide was excellent!)

answered 6 years ago
0

@REDACTEDUSER

I'll structure this first tutorial as a post later, but here is the starting point of SC/UI work. Following this tutorial, you should be able to create and load a simple UI canvas from Script Canvas. I cover a few other things in detail here so that I can ignore them in the next tutorial. The instructions are written generally enough so you can follow everything in any existing project you have and it will work fine.

7301-ui-basics.pdf|attachment (393 KB)ui-basics.pdf

answered 6 years ago
0

@REDACTEDUSER

Good to hear that worked! I should have the next section done today, a main menu with buttons, and a quit confirmation dialogue with buttons. Beyond that, I'll take another look at the samples project example, I know it implements an options menu, perhaps that can be rebuilt step-by-step. 1.15 added quite a bit more UI control to Script Canvas to explore.

answered 6 years ago
0

@REDACTEDUSER

Thank you, I really appreciate all the work your putting into this, and I hope I'm not bothering you too much by asking for this.

answered 6 years ago
0

@REDACTEDUSER

Not a bother at all, I wrote up a bit more, at the end I've left sort of an exercise to complete the graph, I'd be interested if it's doable after reading through the tutorial. Let me know what you think.

7332-ui-basics-2.pdf|attachment (301 KB)ui-basics-2.pdf

answered 6 years ago
0

@REDACTEDUSER Yeah so the only step to return control to the main menu canvas would be to change 'Set is Consuming All Input Events' back to 'True'. If you can flip between the canvases by clicking 'quit' then 'no' repeatedly then everything works fine. I didn't have any specific ideas of where you wanted to go after clicking these buttons, but I'll finish the example graph and post it for comparison. Sounds like you got things down though.

The way you are handing map/level loads with Execute Console Command (and only outside the editor, the editor only works with one level at a time) is the best way that I know of. I do think there will be updates to this process in the future though, the CryEngine method hasn't been replaced yet. You could think of this as a main menu level that only loads the actual game levels, but you probably want this menu to appear when you hit 'Escape', for example, in any level.

In my own project, Clicking new game loaded another canvas where some game options could be set, on that canvas you could hit a start button to unload/hide all canvases revealing the game world on that level and starting another Script Canvas graph that controlled the actual gameplay.

answered 6 years ago
0

@REDACTEDUSER

Thank you, this tutorial has helped a lot, OK so I was able to get the buttons to work, meaning, with the print block, I returned the value of the buttons, and in the console, every time I pressed it, it said true, so that means it works. But with the quit screen, I'm unsure, I was able to load it on top of the other canvas', but I'm not sure what to do next, meaing when I click No, it unloads the canvas, but I don't know how to return control, I probably made it way too complicated, so yeah...

But the guide was great, and as I said, the buttons actually work now which is a good sign, I could just do with a continued guide for the quit screen, I tried but I'm still a bit unsure.

Thanks again for your help. :)

EDIT:

I've just removed the "Print" block and replaced it with a "Execute Console Command", which runs the command "map level" so when you press the button to start a new game, it executes the command and starts the level, this only works on the exported launcher as the console says, "won't execute in editor". If you know another way to load a map with the blocks, please let me know, but I don't think that's a feature yet.

EDIT 2:

I was just able to add a sound effect, so that when you hover over the button, it plays a sound! (It took a bit of trial and error, but I got there eventually!)

answered 6 years ago
0

Hi, thank you for everything. It seems everything is working the way I want it to. I was wondering, with your permission of course, would you mind if I created a video tutorial based around these instructions? I would give you full credit of course, and would link people to this forum post if you don't mind. Would you like me to give any links to your Twitter or YouTube or anything?

Thanks,

Daniel

answered 6 years ago
0

Thank you. I will be sure to send you a link once it's complete. I plan to hopefully start it some time next week.

answered 6 years ago
0

@REDACTEDUSER

Please feel free to use this any way you want. My youtube channel is https://www.youtube.com/user/thistylerisme/ if you want to link.

answered 6 years ago

This post is closed: Adding new answers, comments, and votes is disabled.