Hello, I’m currently following a tutorial for making a fighting game using UE4. However, I have come across a continuous error that occurs on my event tick function. I’m trying to make a camera that adjusts and zooms out in reaction to both players’ movements. I have looked at other similar questions, but mine occurs every tick and is not resolved after the begin play initialization. The tutorial I am following is using UE 4.17 and I am in 4.26, but I am new to using blueprints so I am unaware of any differences. The problem variable is Char2.
^This is my BeginPlay^
^This is my player spawn function that assigns the variables.^
^This is where the error occurs, I’m attempting to get the location of the actor referenced by Char2 (The one set by my second image, it is a reference variable to an actor in my scene called “2DSideScrollerCharacter2”)
This is the error message.
^This is my Variable information for Char2^
You have to set Char2 to an ‘actual’ character. At the moment, it only has the correct type. It needs to reference an instance of that type of character.
How would I go about doing that? I’m just confused why Char1 is working fine, but Char2 is having these issues.
It’s happening constantly, every tick until I stop play
Yes, I set up the 2dPlayer Controller in another blueprint, but I ran Valid checks there and it all works properly.
Are the errors only from the start of tick, before the variable is assigned?
Try turning tick off on the blueprint, and starting about 20ms after begin play.
Or is it happening constantly?
Is this all in the level BP?
Ok, then I still think you’re just getting a lot of errors from the tick before the second player has spawned. Why not try an IsValid on the tick, so it wont run until player 2 is valid…
I don’t really know, but I’m still thinking this is coming back with no actors:
Are both the classes the same here?
Is there a multiplayer thing going on here, or is it just two characters in one level?
That’s where I think the problem is too, and no, the top one is 2DSideScrollerCharacter, while the bottom is 2DSideScrollerCharacter2.
just two players in one level, I do have them teleported to certain locations and the second character doesn’t exist until the first one does. It is designed this way so the correct characters can be spawned in after something like a character select screen.
I tried that, but I am trying to figure out why Char2 isn’t valid in the first place. I require both the Character’s locations in order to control the camera.
But what happens? Does it become valid after a very short while? It could be just a timing thing.
When i put it on the camera, it just sticks to the first character, but when I put the IsValid on the actual variable setting, it never becomes valid.
If you want to migrate the minimum to a default project, I’ll take a look it you like. Otherwise it’s just guessing…