The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Raise event - custom type not found - passing a list of vectors

Itay
2022-01-15 15:18:36

Hello, I'm trying to pass two Vector2 lists using the raise event photon function.

But I get this error:

Write failed. Custom type not found: System.Collection.Generic.List[Vector2]

I saw on this solution: https://forum.photonengine.com/discussion/16726/exception-write-failed-custom-type-not-found-unityengine-transform that I should split the list to the variable but this is impossible since the list size.

This is my code:

Just to understand I'm creating a random road and want to send the corners and the connection between the corners to the players.

private void OnEnable(){

And this is the code on another script:

Comments

SkrenZz
2022-01-16 16:52:00

I am not sure this helps, but perhaps you could instead send each vector one by one in a for loop (maybe with additional arguments of its index, and the total size of the list) and add them to a list of vectors on every client.

Once the list size reaches the total size received in the event, you could sort the list (if necessary) and set the road connections an dots with your RoadCreator class...

I also don't know if you can pass Vectors to Photon Events, if not you could pass the X, Y and Z values instead...

Itay
2022-01-17 17:58:31

My problem was fixed by changing thelist to an array using the theList**.ToArray()**

*note I had to replace the Vector2int array with a vector2 array because I couldn't pass that in either

Back to top