Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

Instantiate object with data

$
0
0
So i am trying to instantiate my player over the PhotonNetwork
using

GameObject thisPlayer = PhotonNetwork.Instantiate(playerPrefab.name, Vector3.up * 5, Quaternion.identity, 0) as GameObject;
var tP = thisPlayer.GetComponent();
tP.GetComponent().Name = MainLogin.LogTextSplitHolder[0];
tP.GetComponent().Score = 1000;
This works for the local player that is being spawned in the editor of unity.
But when i Build and run, the .Name is empty...

Thanks for any help!

Viewing all articles
Browse latest Browse all 8947

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>