I modified the first person character blueprint to do various things. However if I make a new level and import the first person character actor, almost all the things I created in the blueprint do not work. With the exception of the firing/jumping and my move forward function, nothing works. Even stranger is normally you can see lights fire off in the blueprint, but I do not see them on the new level even on the stuff that works.
I’ve been combing every option and checking every component but I don’t see why it’s not working. Is there something I need to do when I create a new level?
Do you happen to have any screenshots of your broken code for a more specific example? It is kind of hard to narrow down what the problem could be without context.
Sorry for the very late response, had a busy week. I didn’t link anything because it was a very general issue and I thought I missed something that could be resolved without looking at it. Yes that’s a silly thought process.
This is my code to smoothly turn 90 degrees left or right on A/D input however it does not work on any level but the default level for some strange reason.
At the end of the rotation it sets a variable so the camera keep track which direction to move in order to move ‘forward’. Not the most sophisticated solution but it works.
The only part of the code that does work outside of the default level is my move forward code.
Not shown in the image is a branch to check what direction the camera is facing and slight variation of the same exact code for the four directions. However because I can’t turn my direction will never change from north (my default direction and the direction every level will start with) so I can only move forward and back so only the one in the image will run. The default FPS firing code works too.
Any other level I make
-Only moving forward and firing works.
Does it stop working on a new level, or a new project? If a new project then check project settings to be sure that it is using the correct character.
If it is a new level, be sure that in the world settings of that level it is using the correct gamemode. This can sometimes be set to the default gamemode and not contain your custom character.
It happens only in new levels. The game mode is FirstPersonGameMode and it is FirstPersonGameMode in the new level and the default pawn/playercontroller class match up. Also forgot to mention in my follow up response that any input regardless if the code is working or not, it does not light up in the blueprint simulation like it does in the default class.
I.e if I press forward, I will move forward but the nodes in the blueprint for moving forward won’t glow. However if I go back to the default level it will work as intended.
You just need to set debugging object to see it ‘glow’.
I’d bet that your default values aren’t set in the character, but are set in the default level (somehow)- though from the looks of it that should not matter.
Try going to the default level, and if you’ve dragged your character into it, select the character in world, then look at it’s details pane. Pay attention to any variables you see there, and go make those variables have those same values in the blueprint details panel.
I suspect your booleans aren’t set up correctly at the start, so you can’t actually pass the check to rotate. Though, the same booleans are set after a move, so if you can move at all, you should be able to then rotate. If not, then something is wrong deeper in your logic.
Thank you, that solved the glowing issue so it IS running through the full blueprint code, just wasn’t working for one reason for another. What I did notice that when I start in the default level I only have a single FirstPlayerCharacter.
However in my new level I always have a second one pop up once I hit play, either FirstPersonCharacter375 or another large number.
Turned out you were right about variables not adding up. In the new level, the auto possess player was default so I assume it was making a new FirstPlayerCharacter and possessing that instead (but my rotation code still referred to player0).
Thank you both for the help.
Just a tip: The actors in that list that are kind of yellow-ish are spawned in runtime. So if you remove the first person character in the level, or set it to autoposses player 0, you should only have one character.