Spawner BP that has the event from the SpawnerInterface that was added to class settings.
UI Widget BP that has a button that calls the SpawnCoin function from SpawnerInterface on push
I added some debug messages when the button is clicked it calls SpawnCoin after spawn coin it prints: Spawn Coin called.
On the even side it has another print statement. Spawn function called.
The first Spawn Coin called fires but the print on the event trigger doesn’t. I’ve followed all the youtube guides and can’t seem to get it to work.
I apologize if I’m just dumb and appreciate the help here.
Here is what I’m creating / doing to add some context. I’m creating a plinko game. There is a coin that is animated that is bouncing back and forth at the top of the plinko board. When the user clicks the UI button Drop it is going to spawn a coin where the animated coin is at that moment in time. Meaning I want it to include the horizonal momentum so the user has to time the release properly and induce some randomness.
I have my Character Blueprint which creates the UI widget and locks the camera and shows the mouse for clicking the UI with stationary 3d camera.
So I moved the function into my UI widget and it works. I just don’t understand how to use the interface to call the function.
Then it calls the event through the interface. What I might be missing. I know in unity I would attach my blueprint / script to an object in the world. What I don’t understand here is if I have to instantiate the SpawnerGame blue print for it to recognize the even and be running in game.
I might be missing that because I’m not really sure. Any resources you can recommend so I can better understand this one small thing and it would unlock a lot for me. I’m a developer I’m not used to visual programming and I think I’m missing some fundamental key here.
If you got an hour to jump in discord and teach me I’ll pay you 100 dollars and hour for an hour lol to just teach me this basic thing I know I’m tottally just missing. Because it works perfectly when its all in my UI. I also understand how to pass variables between blueprints but I can’t get the event stuff to work.
so that’s almost one part of the puzzle solved. How does the player get into the game? Did you place in the level? Is it spawned dynamically by the Game Mode using player start?
Spawner BP
this remained unanswered. Where is the instance of this BP created? By whom, and when?
Once you know where stuff is, it’s trivial to make it talk, hence this line of questioning
I also understand how to pass variables between blueprints
you’d have a reference to the target actor instance and set its variable, right?
you’d call a regular function in the same exact way, right?
and so you’d call the Interface, there is no difference
All you need is a reference to the instance of the actor who implements the interface. Calling an interface is the same as calling a function on the target BP. For this you need to know your target.
bascally all it does is restrict so the user can’t move the camera and give them a cursor to click the play button. I made all the logic work by putting everything basically under the UI BP but I still would like to know how to make the function interfaces work.
I’ll read the link you provided I appreciate it.
I’m having another issue now too where I’m trying to activate a Niagara component that is attached to one of the score zones when a score happens. it is attached to the blueprint element, for the score zone blue print which has the scoring logic when a coin lands and stops moving on it.
There is no error in the compiler it plays correctly in the view port of the element. When I spawn that blueprint in game and the coin is erased it doesn’t trigger the activate or something because it never plays and auto activate is off.
I don’t know what that means. You still did not answer the questions.
• the player creates the UI, great
• how does the player get into the game (placed in the scene, spawned with a node, spawned by the game mode?)
• how does the BP Spawner actor instance get into the game?
This is not an issue with an Interface. This is never an issue, neither is casting. This is an issue with referencing. You say you know how to pass variables between BPs, but the widget is not even referenced, not can we see a dispatcher.
Also, if you feel you must use Get(All)ActorOfClass, things are already not great communication wise. At least not for something like this since the nodes exist for a reason and can be handy. They are just misused or used instead of communication. It’s a very short lived “solution” which creates a lot of confusion and stops working rather quickly.
This is an even bigger issue. Widgets are volatile, their role is to show stuff, handle UI and player input. The very last thing you want user interface to do, is to run logic. Even if the game is just an interface (like a puzzle game), do consider avoiding it.
This is great. Clear. We only need to know where this stuff is so it can be hooked up and talk. It does not even need an interface since it serves a very different purpose.
There’s still no need for an interface in any of this. I’d go as far as saying this is no place for an interface. You know, upfront, who you want to communicate with and all of this must be loaded anyway. You’d use an interface if you did not know that.
@pezzott1 as discussed earlier, add it to the research list? I’m gonna now look into the subsystem you mentioned which may simply make all my knowledge redundant if it really works as advertised…
@Everynone Man I really appreciate you that helps so much. Now that I got everything working in my first attempt I can modify it to what you just showed me and do the event driven way instead of the way I’m doing it.
Super helpful!
On a similar note of things not firing or not working. I’m trying to activate a Nigara effect when a coin has come to a rest on the winning zone. I followed a youtube video to make sure I wasn’t doing something stupid.
The setup I have a blueprint object with a treasure box and a child component that is a Niagara effect with auto activate turned off. If I turn it on in the viewport on my blueprint it plays but when the parent object blueprint calls activate when someone scores it doesn’t play the effect.
I also tried spawning it and that didn’t work either. The activate way is what I read is the way you should do it and saw on youtube.
Here is my blue print you can see NS_Death_Coin as a child object of Landing_Zone_Low
Its a child component of the treasure chest so it must be instantiated in the game correct. Thus, I don’t see why activate isn’t working because its modifying its child. Not gonna lie this stuff is much easier in Unity to learn but I feel once I learn it here it will be much faster to build…
Link to current build:
If I’m not allowed to post links let me know and I’ll remove… Its just a simple windows build…
Once I figure this partcle stuff out I can really get cooking with backend game service that does the user service, login, transactions, etc. I just want to do some particle flashyness when you win and bonus events like a slot machine… So any input here would be super helpful. Going to work on changing things to purely events today.