At first I thought it was my blueprints calling the function many times but then I just put it to the test on Begin Play in Level Blueprint and my actor still got spawned forever. Why would this be the case? Help please!
You mean something is spawning the actor repeatedly? Check the begin play on your actor, make sure you don’t also have a “Spawn actor from class” in there (so every time one is spawned, it spawns another one).
Thanks for the answers guys! The weird thing is the actor spawns fine if spawned from a key, but when spawned by another event it just spawns forever. Here is the function I use to spawn it from the Event Tick. The actor is a Rune item. Inside the Rune blueprint there’s only the logic of it being picked up with a component begin overlap, and nothing more. I don’t get why it works fine when spawned from a key. Again, it even spawns like that from the Level Blueprint.
Show us all the BPs where you call “Spawn Rune”.
The Destroyed bol is not about the Rune, but about another actor. The character breaks a stone and then the Rune is revealed inside. All this is irrelevant since this problem occurs in the Level Blueprint also with the simple code Event Begin Play -> Spawn Actor from Class and a random location in the world. I added a print string and apparently the Rune_BP spawns indeed once, but visible there are clearly more inside. So maybe there’s something about the Rune itself, however I can’t seem to find anything weird about it. Also, how come when the villager drops the rune by pressing a key it’s only one?
Either use the Scene Outlier or as franktech suggested use “Get All Actors of Class” to see how many Runes there really are.
Hmm, this is very weird. So the code runs only once but spawns multiple Runes for no reason. I am very stuck with this one. Gotta hate when something really simple becomes really complicated.
My mindset is to always blame my code but the fact that I can spawn from key just fine but not from anywhere else gives me mixed signals. The rune bp is empty. Has no relevant code what soever. So spawning it from the game mode, level blueprint should be just fine just like spawning it from key. But no. Redid the Rune BP and it works. Spent more time debugging than redoing it.
Thanks for the input franktech. Really appreciated.
I took a break, worked on some other things and debugged a little more now. The problem is deeper and is somehow connected to my client, as only clients see more runes than there really are. I fear there is something wrong with the way I set up the player spawning as I really had a hard time doing it the way I need it, and it may have broke some things.
This area of player controller is really foggy to me and I have postponed some tasks related just because I can’t seem to figure it out. If you could help me that would be great.
In my game the Host plays as a Vampire and the 4 Clients play as Villagers. I feel the way I make them spawn this is way is a little wrong, you tell me.
In my Player Controller on Event Begin Play I call for an event in the Game Mode. As I type this I remembered that the Game Mode cannot be accessed by clients, however this is how it works now.
In the Game Mode I have the logic to spawn the host as a Vampire in a desired location (so not from a spawn point because I couldn’t get this to work) and the clients as villagers.
The reason I believe there is something wrong is that I also can’t seem to make the correct HUDS appear for each individual player (the vampire should have his own, for example).
I would really love it if you could point me in the right direction as this is the only big issue that still lingers in my project.
Thanks a lot!
Alright, finally managed to spawn the correct huds from the player controller. You can do so much in so many places that sometimes you don’t know where it’s the right place to do it.
The rune is still a problem on client. I have no more ideas for it
I can spawn the actor from anywhere and the client sees it many times. I mean a lousy spawn on begin play, not something with variables and more complicated stuff.
Pff, figured it out. Originally the pink nodes were swapped and when the villager overlapped the rune it first set his status as HasRune and then tried to destroy the actor. But becasue there is that branch that runs the code only if he is not having a rune I guess the Destroyed Actor never got called. Except, everything else was called, even a print string at the end. It’s like for the destroyed actor the switch was instant but for the rest it was not.
Very weird. So freakin happy I fixed this. Thanks for the help franktech! you kept me going, digging and digging.