Bolt Events
Ruslan
✭
in Photon Bolt
I doing all like in this tutorial
Calling a global event
https://doc.photonengine.com/en-us/bolt/current/reference/events
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Singltone : Bolt.GlobalEventListener {
private static Singltone _instance;
public static Singltone Instance { get { return _instance; } }
void Start()
{
_instance = this;
DontDestroyOnLoad(gameObject);
}
public void upPl(int pl){
Storage.PlayerChoose = pl;
//EVENT WHAT I NEED!
var evnt = EventPlayerChoose.Create(Bolt.GlobalTargets.Everyone);
evnt.EventPlayerChooseInt = Storage.PlayerChoose;
evnt.Send();
}
}
But I get an error:
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[Bolt.UniqueId,Bolt.IFactory].get_Item (UniqueId key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
Bolt.Factory.Create (UniqueId id)
Bolt.Factory.NewEvent (UniqueId id)
EventPlayerChoose.Create (Byte targets, .BoltConnection connection, ReliabilityModes reliability)
what is the reason????
Calling a global event
https://doc.photonengine.com/en-us/bolt/current/reference/events
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Singltone : Bolt.GlobalEventListener {
private static Singltone _instance;
public static Singltone Instance { get { return _instance; } }
void Start()
{
_instance = this;
DontDestroyOnLoad(gameObject);
}
public void upPl(int pl){
Storage.PlayerChoose = pl;
//EVENT WHAT I NEED!
var evnt = EventPlayerChoose.Create(Bolt.GlobalTargets.Everyone);
evnt.EventPlayerChooseInt = Storage.PlayerChoose;
evnt.Send();
}
}
But I get an error:
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[Bolt.UniqueId,Bolt.IFactory].get_Item (UniqueId key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
Bolt.Factory.Create (UniqueId id)
Bolt.Factory.NewEvent (UniqueId id)
EventPlayerChoose.Create (Byte targets, .BoltConnection connection, ReliabilityModes reliability)
what is the reason????
0
Comments
-
Follow the steps here https://doc.photonengine.com/en-us/bolt/current/getting-started/bolt-103-events0