I am currently building a simple 2D game. I don’t really understand why but when I build and run my game, the view on the client and host is different. Could Anyone tell me why? Thanks.
I am sorry. Let me fill in the details:
- It is a 1.v.1 2d multiplayer shooting game.
- I use Unet.
- I currently have built a custom UI, which allows the player to host a game or join as client.
My player has a parent, and the parent has the Network Identity and Network Transform Component, with a PlayerNetwork script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class PlayerNetwork : NetworkBehaviour
{
public GameObject Player;
private int count = 0;
public override void OnStartLocalPlayer()
{
GetComponentInChildren<PlayerMovement>().enabled = true;
GetComponentInChildren<SimpleShoot>().enabled = true;
}
}
This script is used to control the child gameObject, the real player.
The real player only has components like movement scripts and health scripts which are not related to Networking.
Hope that detail would help!