OnInput not call

ykyrus
ykyrus
edited April 27 in Fusion

Hello Fusion Team

For example Fusion 100, I make "Player.cs" inherit from INetworkRunnerCallbacks

public class Player : NetworkBehaviour,INetworkRunnerCallbacks

I see OnInput in file "Player.cs"don't call. it only call in file "BasicSpawner.cs".

When spawn Player i see we have set InputAuthority

NetworkObject networkPlayerObject = runner.Spawn(_playerPrefab, spawnPosition, Quaternion.identity, player);


Why it happens ?


Best Answer

  • emotitron
    emotitron ✭✭✭
    Answer ✓

    INetworkRunnerCallbacks will automatically be found by the NetworkRunner if your component is on the same object as the NetworkRunner. However If this component is NOT on the same GameObject as your NetworkRunner, you will need to register your component for callbacks using Runner.AddCallbacks(INetworkRunner).

Answers

  • emotitron
    emotitron ✭✭✭
    Answer ✓

    INetworkRunnerCallbacks will automatically be found by the NetworkRunner if your component is on the same object as the NetworkRunner. However If this component is NOT on the same GameObject as your NetworkRunner, you will need to register your component for callbacks using Runner.AddCallbacks(INetworkRunner).