I have two identical levels with different day/night light bakes. I want to be able to switch between the two with a keypress. Easy enough. However, I want to transfer over my current character location into the level load (so that I’m in the exact same place when I load the new level).
Simple!
Step 1: Load the player’s current transform (or full state if you want,really its not hard!) into the GameInstance class
Step 2: Open the new level
Step 3: Set the player’s transform on the event begin play (of the level or character BP ) that you grab from GameInstance (be sure to make a check that there are actual stuff inside the gameinstance(for example test that location and rotation != 0,0,0)
I seem to be setting the transform correctly, as I am seeing it update with my print string. However, I’ve yet to successfully ‘appear’ anywhere other than the default starting location. I know the issue: Is Valid. I know that isn’t the right node (I can’t plug a variable into it), but I can’t find the correct way to check whether my variable is null. I think that if I get that going my BP will work.
Also, I currently have a flipflop set up for my level load (alternating between the two). I don’t think this will work correctly (and if it does, I’m sure it isn’ the best way to go about it). How would I check to see which level is loaded, and then load the opposite? Make sense?
you need to actually check wether your transform has been set. For example set it to something default for the first time (like the default start position) and then just set the transform on begin play for each next time normally.