How I can switch the StateAuthority?

Options
nebulatechhub
edited June 2022 in Fusion

In server user can change Network object property but In client user can not change the network object. In server "HasStateAuthority" showing true and client game showing false. But want to it showing also true in client also.. Plz plz plz help me.

Answers

  • WARdd
    WARdd ✭✭
    Options

    I think this is only possible in shared mode, in that case you can use request state authority:

    public async void GetAuthority() {

    if(Runner.IsSharedModeMasterClient) {

    Object.RequestStateAuthority();

    while(Object.HasStateAuthority == false)

    await Task.Delay(100); // wait for Auth transfer

    //do stuff with your new authority

    }

    }

    Otherwise the server probably needs to handle whatever it is you want to do