Search Unity

Question "Display 1 No cameras rendering" issue:

Discussion in 'Multiplayer' started by unity_fLygVOFP0-9L1w, Nov 4, 2021.

  1. unity_fLygVOFP0-9L1w

    unity_fLygVOFP0-9L1w

    Joined:
    Aug 11, 2019
    Posts:
    1
    In my online multiplayer game, if I hit "PLAY" whenever I attempt to spawn a playerprefab , I get the error "Display 1 No cameras rendering" (see picture)


    display 1 no cameras rendering.PNG

    However,

    Whenever I run the game by hitting "ctrl+b" or "build and run" I am able to hit spawn to spawn my player prefab and it works perfectly. (see picture)

    build and run.PNG


    Any clue as to why this is?

    Ive even tried running the game from different computers and it works fine, its just when trying to play from hitting "play"


    Ive attached copies of each of my scripts but Ill try to explain it further:





    The game uses photon network commands on a game manager script to spawn the player:

    public class GameManager : MonoBehaviour
    {
    public GameObject playerPrefab;
    public GameObject canvas;
    public GameObject sceneCam;


    void Awake()
    {
    canvas.SetActive(true);
    }
    public void SpawnPlayer()
    {
    float randomValue = Random.Range(-5, 5);
    PhotonNetwork.Instantiate(playerPrefab.name, new Vector2(playerPrefab.transform.position.x * randomValue, playerPrefab.transform.position.y),Quaternion.identity, 0);
    canvas.SetActive(false);
    sceneCam.SetActive(false);
    }

    }

    the player prefabs camera is set to off by default

    and then uses the players script to set the players camera to active if photon recognizes the player is here with the photonview.ismine command:





    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using Photon.Pun;

    public class CowBoy : MonoBehaviourPun
    {
    public float MoveSpeed = 5;
    public GameObject playerCam;
    public SpriteRenderer sprite;


    // Start is called before the first frame update
    void Awake()
    {
    if (photonView.IsMine)
    {
    playerCam.SetActive(true);
    }
    }


    ANY ASSISTANCE WOULD BE VERY MUCH APPRECIATED!!!
     

    Attached Files:

    Last edited: Nov 4, 2021