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 Fusion.

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.

Anyone working host migrating Photon Fusion advance asteroids in Unity 2022.2.1f1?

HorangPark
2023-01-03 14:33:05

Hello!

I'm trying to do running Photon's official Fusion Unity sample game called Advance asteroids.

Everything working on Unity 2022.2.1f1 and build too.

but I was running host on "build file (like an exe file)", and running client version on "editor".

and I did quit host, editor(client) show many error log in each frame.

I think, the reason was GameStateController is not restored(spawn). also releasing log says "isSceneObject: true".

am I need to remove GameStateController GameObject in scene and try to spawning GameStateController? or did testing wrong or need to fix configurations?

Thank you.

Comments

HorangPark
2023-01-04 03:11:36

I did 2020.3.35f1, It's not working too.

PoPo4860
2023-01-04 09:02:32

I've been through the same situation as you, and at I think a little code modification has made it work.

I hope my experience is helpful.

That's the first problem.

GameStateController will not be recreated.

In the process of Host Migration, runner.GetResumeSnapshotNetworkObjects()

The deleted GameState Controller is not loaded.

I don't know exactly why, but it seems that only objects created by Runner.Spawn() are imported.

My solution.

AsteroidsGame.cs

[SerializeField] private GameStateController _gameStateController;

public void OnSceneLoadDone(NetworkRunner runner)

{

}

This is the second problem number two.

Bullets have not been generated, but there are times when an update is attempted.

My solution.

SimpleObjectCollection.cs

public void SimpleFixedUpdateNetwork(NetworkRunner runner, NetworkBehaviour owner)

{

}

Here's the third problem.

The Spaceship Controller has not found the _gameStateCtrl since migration.

I didn't know the exact reason, but I found the moment when I lost the _gameStateCtrl and put it back in.

My solution.

SpaceshipController.cs

public override void Migrated()

{

}

public override void Despawned(NetworkRunner runner, bool hasState)

{

}

Here's the fourth problem.

There has been a phenomenon in which the score data could not be imported since the migration.

My solution.

MigrationManager.cs

var newNO = runner.Spawn(resumeNO, p,q, PlayerRef.None, (networkRunner, o) =>

{

if(o.TryGetComponent(out var spaceshipController))

{

spaceshipController.CopyStateFrom(resumeNO.GetComponent());

}

});

HorangPark
2023-01-04 09:08:15

Wow! thank you so much!

Back to top