Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Photon causing a 'weird' error

Discussion in 'Editor & General Support' started by BlakeGillman, Sep 8, 2017.

  1. BlakeGillman

    BlakeGillman

    Joined:
    Dec 7, 2013
    Posts:
    412
    There is absolutely no reference to a Sprite of any sort in this script but somehow it is causing this error:



    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class AssignStarting : MonoBehaviour {
    6.  
    7.     // Use this for initialization
    8.     void Start () {
    9.  
    10.         // Find what country this player is
    11.         string thePlayersCountry = PhotonNetwork.player.CustomProperties["playerCountry"].ToString();
    12.  
    13.         // Find all countries
    14.         foreach (CountryManager country in GetComponents<CountryManager>()) {
    15.             // Grab the name of the country
    16.             string countryName = country.countryName;
    17.             //Debug.Log (thePlayersCountry + "/" + country.countryName);
    18.             // If the country name equals the player countrys name (AKA this player is this country)
    19.             if (countryName == thePlayersCountry) {
    20.                 //Debug.Log ("Match!");
    21.                 // Tell the country manager that the player is this country
    22.                 country.isThePlayer = true;
    23.             }
    24.         }
    25.     }
    26. }
    27.  
     
  2. BlakeGillman

    BlakeGillman

    Joined:
    Dec 7, 2013
    Posts:
    412
    At further research something is triggering this when countrymanager's variable "isThePlayer" is equal to true. But I sitll have no solution