Download

Select Player(car) in GarageMap Menu, then load that player in the driving map.

I have a working garage map (garageMode_BP in which the player is attached to camera and can only click buttons). Buttons across the top to select a car that shows up in viewport (Garage Widget). This all works great.

And I have a button ‘start’ that loads the driving map. That works. ( I just have a player start in that map currently that uses the default vehicle)

I am really thick so bear with me :wink:

I want the car that is selected at the time the player pushes start to be the one that is spawned.

I was looking at an **event dispatch **as a possible solution. This is where the my thickness comes into play. Of all the tuts I have found none are very close to what I need. The ones that are are part of a series and they use blueprints that were created in some random video 28 tuts deep.

Currently when I click a button (garage widget), it sets an integer that controls which vehicle is spawned and which buttons can be used (if you select button one then it will be grayed out so you can’t click it again, until you use another button and so on.
I thought I would be able to make that integer public and use it in the driving map to choose the car to spawn. I would love to just use that but can’t figure it out.

You could upon pressing Start in the Garage, save to the Game Instance the car selected, and upon loading the Driving Map, cast to the Game Instance and grab the car selected and spawn that one since the game instance is persistent.

OK thanks Jimminy,

Working on Game instanc variable right now :wink:

This is what I have, the cast fails. according to the tut (4.6 I think it was, I am using 4.21.2)

First of all, I like the string you used for when it fails lol. I do it also.

Second, have you ensured that in your project settings, under Maps & Modes, at the bottom where it has Game Instance,you have selected the game instance you have created?

This is the problem with not using UE4 for a few years, coming back and piecing things together with various tutorials and not really understanding everything :slight_smile:

After watching a few more, being confused but hearing little snippets in those tuts that really made me understand…

As simple as my game is so far, it was getting messy.
I followed a tut for endless runner tile spawn, which had me create a new game mode, I created a menu in the base map, disabled player…

Now I’m cleaning up. Garage Mode is gone, I’m simplifying and cleaning up before I go further.

Thanks for the help, I’ll post back when I’ve got everything sorted and it should be easier to figure out at that point.

OK , I’m back!!!
Man what a mess. I have half the widgets and maps and BP’s as before… Nice to clean house.

I solved this by using a custom Game Instance with a variable that could be set in my menu widget and read in map_bp by a cast to game instance…

BUT
You HAVE to set that game instance in your project settings> map/modes or you just get errors :slight_smile:

Well done. The more you learn the more efficient you become. I’ve redone my project several times as i’ve learnt new things and it’s actually been fun doing it and seeing the reduced number of Blueprints etc needed to perform what I needed each time and making it more modular so any further changes required etc can be done with ease. I’ve enjoyed just messing around in UE.