Exception on Event.Create() .. "You are not the server of, you can not raise this event"
Hello Forum!
I am trying to create a log system, where the player can see messages like "xx has joined the game" or "xx was shot down". Stuff like that.
I have created an Event in the Bolt Assets window, I've created an OnEvent(event xx) and the Event.Create()/Send(). (see pictures below).
Every time the client connects he gets this error: A picture of the error.
Here the event in the Bolt Assets window: A picture of the event
The following code inherits from another script (which inherits from Bolt.EntityBehaviour<ICarState>):
The following code is attached to a canvas of a child object of the car-entity:
I have also tried moving stuff around. For example sending the event from the base script. Or putting the OnEvent on a gameobject in the scene..
Help and explanation is much appreciated.
Cheers,
Laurence.
I am trying to create a log system, where the player can see messages like "xx has joined the game" or "xx was shot down". Stuff like that.
I have created an Event in the Bolt Assets window, I've created an OnEvent(event xx) and the Event.Create()/Send(). (see pictures below).
Every time the client connects he gets this error: A picture of the error.
Here the event in the Bolt Assets window: A picture of the event
The following code inherits from another script (which inherits from Bolt.EntityBehaviour<ICarState>):
public class LB_Car_Network : LB_BaseCarRigidBody_Controller { public override void Attached() { state.SetTransforms(state.CarTransform, transform); var evnt = PlayerJoinedEvent.Create(); //here I get the error evnt.Message = "Name joined the game"; evnt.Send(); } protected override void HandleNetwork() { } }
The following code is attached to a canvas of a child object of the car-entity:
public class LB_Car_NetworkUI : Bolt.GlobalEventListener { public TextMeshProUGUI logsTMP; public override void OnEvent(PlayerJoinedEvent evnt) { logsTMP.text.Insert(0, evnt.Message); } }
I have also tried moving stuff around. For example sending the event from the base script. Or putting the OnEvent on a gameobject in the scene..
Help and explanation is much appreciated.
Cheers,
Laurence.
0
Best Answers
-
You set the event so that it can only be sent from the server, but attached is called everywhere. Therefore your clients are trying to send the event.0
-
@stanchion I have tried setting the global sender to "only client" and "only server" and I have also tried setting global sender to "none" and setting entity sender to "only owner".
None of them work..0 -
You are sending it no matter what, so if you say you can only send in specific cases it is going to tell you that you have set it to not allow that.5
Answers
-
Sorry the links aren't working.
Here the error: https://drive.google.com/file/d/1pw-qo-9IhmbgLlac3CGPNWCS8AYdPCqb/view?usp=sharing
and here the event: https://drive.google.com/file/d/1TXH8xGG1fs2BHgrBCE6MJ6rDJErEQqDR/view?usp=sharing0 -
You set the event so that it can only be sent from the server, but attached is called everywhere. Therefore your clients are trying to send the event.0
-
@stanchion I have tried setting the global sender to "only client" and "only server" and I have also tried setting global sender to "none" and setting entity sender to "only owner".
None of them work..0 -
You are sending it no matter what, so if you say you can only send in specific cases it is going to tell you that you have set it to not allow that.5