Hi guys, how can a client have more than one object?
I have this simple code:
void Start ()
{
Debug.Log("HAS AUTHORITY: " + hasAuthority.ToString());
if(hasAuthority == false)
{
Debug.Log("Destroying the ENTITY");
Destroy(this.gameObject);
}
CreateAvatar();
}
public void CreateAvatar()
{
GameObject avatar = Instantiate(PlayerAvatar) as GameObject;
NetworkServer.Spawn(avatar);
}
This is object was created as “The Player” and the authority is correct, every connect client has authority over its Player, but how can I get authority over the spawned “Avatar”?
Everytime it says I don’t have authority over the spawned object, this is the “Avatar”
void Awake()
{
if(hasAuthority == false)
{
Debug.Log("Disabling the Movement because I am not the Owner of this");
this.enabled = false;
}
}
Cheers