Camera - Set View Target With Blend Issue

Hello Guys I have a Problem with the client/server camera. When Client Press the key to change the camera to GunCamera It change to GunCamera But in the servers one. not in the Client.

But if the server press the key to change the camera it works fine.

Hi THT_Nick

If you are using input events, then they should be called on the client anyway. Where is your “GunCamera” reference getting created? Are you sure it is set on both the server and client? If it is set on the server, you should set the GunCamera variable to replicate.

272122-replicatedvariable.png

To begin debugging, I would set up an event specifically called on the clients to ensure that the logic is getting called. But as I said, from an input event, this shouldn’t be necessary.

I would look at your log outputs to see if you have any “Accessed none trying to read…” warnings.

If you’re still stuck could upload a screenshot if your input events and the events/functions calls which should call this logic on the client.

Hi THT_Nick

“SetViewTargetWithBlend” isn’t a node I have used before, so I have just created a networked project and tried it out.

I am assuming that the “Gun camera” is used as a like a scoped view right?
The server doesn’t really need to know if the camera is aiming down a scope. This type of functionality is only relevant to the client.

Here is my setup.

If this solution doesn’t work for you. Let me know in a bit more default what you are trying to achieve (including any data you would like replicating) and I will take another look.

Good luck :).

I forgot to mention I disabled “AutoActivate” on the scoped camera so it will only be active when I tell it to be using my code.

I have taken a look at the log file you submitted, at it appears you have some potential issues which might be affecting your code.

Blueprint Runtime Error: "Accessed None trying to read property soldier". Blueprint:  Spawned_AK Function:  Execute Ubergraph Spawned AK Graph:  ForEachLoopWithBreak Node:  Branch

A for loop somewhere in your code is trying to access an object called “soldier” which either doesn’t exist or your references aren’t set correctly.

Blueprint Runtime Error: "Accessed None trying to read property CallFunc_BreakHitResult_HitComponent2". Blueprint:  Soldier Function:  Execute Ubergraph Soldier Graph:  EventGraph Node:  Branch

This error looks like you trying to break a hit result from an overlap/collision event. Your code could be assuming that this object will always be a soldier, but without seeing the code I can only speculate.

I would make sure you add “IsValid” checks before accessing properties of references you’ve stored at runtime.

My last piece of advice would be to pay attention to your naming. Keep objects and variables named appropriately will make it simpler when debugging and for anyone else reviewing your code.

As mentioned in my last answer. If the solution isn’t correct, or I have misunderstood what you are trying to achieve, let me know and I will take another look.

Hello Alekann01 Thank you for answering my question.

First as you can see in the Picture I tried to call it with the event but the problem still exists I have some Warnings you can check it.

272110-bp2.png

[Error Log][3]

Finally It’s working Thank you. The problem was the Replication with the server (No Needed).