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.

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.

Spawning AI enemies using object pool and Photon

FunkyYosh
2023-03-22 13:57:56

Hi there, I'm making a 3D unity multiplayer game and I'm currently trying to implement the AI with multiplayer. I got the AI to work in a seperate test scene using object pooling, but now I have to implement this AI into my actual game scene with the multiplayer but I'm unsure how to do this.

I have a photonview component on the gameobject that uses the below script, I've tried using photonView.RPC but I then get the error that I "can't use custom types" like the Enemy or enemyObjectPools variables.

This is my current EnemySpawner script:

I would be very grateful for any help on how to get started, if I need to provide more scripts or context I'd be happy doing so.

Comments

Tobias
2023-03-27 15:04:49

The error "can't use custom types" like the Enemy or enemyObjectPools variables is due to those not being serializable for Photon. You need to write code that sends instances of those types via the network (as a byte[]).

When we fixed the doc pages for this topic, check out the info about Custom Types.

Back to top