Search Unity

Define an alias to a class name?

Discussion in 'Scripting' started by Vencarii, Mar 15, 2019.

  1. Vencarii

    Vencarii

    Joined:
    May 19, 2016
    Posts:
    9
    Hi there,

    I fiddle around with Photon at the moment. When I try to get a list of all players in a room I need to write

    Code (CSharp):
    1. Photon.Realtime.Player[] players = PhotonNetwork.PlayerList;
    That's the case because I have a script called Player myself. Is there a way to define an alias like

    Code (CSharp):
    1. using Photon.Realtime.Player as PhotonPlayer;
    or something?
     
  2. Stevens-R-Miller

    Stevens-R-Miller

    Joined:
    Oct 20, 2017
    Posts:
    676
    You're pretty close. Try this:
    Code (CSharp):
    1. using PhotonPlayer = Photon.Realtime.Player;
     
  3. Vencarii

    Vencarii

    Joined:
    May 19, 2016
    Posts:
    9
    That works, thanks! :)