How do you add objects with press of button or click of mouse

Hi
i am trying to make an game in which when the player press a button or clicks a ball is added. like when the game starts the user will click or press space bar and ball should be added to the boat, like on top and it will fall in the boat and the player can add as many ball as he or she like, but what i tried to do was make the ball visible and when the player press space bar it makes the ball visible but that don’t work either

this is fairly straightforward…

using your boat and ball as an example:

SpawnPointBP - set up your own actor BP, using a blank/dummy scene component… maybe call it SpawnPointBP. In the event graph, use the Spawn Actors of Class to spawn MyBallBP actors… you can run this off Tick, using a looped delay to slow down the spawn rate… otherwise you’ll fill your boat up instantly. Or use a keypress to trigger spawning

MyBall BP - set up another actor BP, MyBallBP, with a static mesh component (a ball) and collision component (a ball shaped collider)… set up its physics so it collides with the world and bounces around appropriately

Finally, drop SpawnPointBP into the scene at the location where you’d like your objects to drop from.

Like this?

https://gyazo.com/0e203eafd52e547b1078749d6e7fd6e0

Create a boat actor. Create a ball actor. Click on boat > spawn ball:

yeah like that

hey see when i put spawn actors of class to spawn spawn pointbp what should i put in for spawn transform

this is where you specify the world location (and optionally, transform and scale)… Use Get Actor Location location to get your spawn point’s own world location

or use Get Actor Transform…

this is what i have in spawnpointBP, and when in MyBallBP i made static mesh and in that i made an sphere but this still doesn’t work

Actors do not receive input by default. You may need to enable it for the player in that blueprint’s Class Defaults.