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.

Runner.Spawn spawn wrong position on a client

Mikhail123
2023-03-06 14:45:08

When spawning prefab NetworkObject using Runner.Spawn() , host spawn prefab on set position, but on client it is spawned on a default prefab position.

Network object does not have NetworkTransform component.

Am I doing something wrong?

Should I set the position externally?

Please help

Comments

WARdd
2023-03-23 09:17:02

I'm guessing if your prefab doesn't have a networktransform or networkrigidbody Fusion assumes the position/rotation doesn't matter. It's a bit silly, since you can still pass null values to position/rotation to make it explicit it doesn't matter, but whatever..

If you only need to set a single position once you can use

public override Spawned()

Which will run on all client simulations. You would have to pass any info you need -say an index pointing to the right spawn point- via OnBeforeSpawned function in Runner.Spawn() and store it in a Networked variable.

If you need to pass an arbitrary position/rotation or the object can still move over time, you probably just want to give it a NetworkTransform.

Back to top