fix: NRE in tanks example when running in headless server only (#2326)

This commit is contained in:
uwee 2020-10-09 08:23:47 -04:00 committed by GitHub
parent 5db733e566
commit 6e44e6e526
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,9 +35,12 @@ public class Tank : NetworkBehaviour
void Update()
{
nameText.text = playerName;
nameText.transform.rotation = Camera.main.transform.rotation;
if(Camera.main)
{
nameText.text = playerName;
nameText.transform.rotation = Camera.main.transform.rotation;
}
// movement for local player
if (!isLocalPlayer)
return;