Won't instantiate

Here is my code ( javascript )
function OnJoinedRoom()
{
	var player : GameObject = PhotonNetwork.Instantiate("PlayerPrefab", Vector3.Zero, Quaternion.identity, 0);
}

I have PlayerPrefab in a Resources folder, and It is properly setup with a PhotonView ( I am following the marco polo tutorial )

Why am I getting this error:
NullReferenceException: Object reference not set to an instance of an object
RandomMatchmaking.OnJoinedRoom () (at Assets/Scripts/Networking/RandomMatchmaking.js:23)
UnityEngine.Component:SendMessage(String, Object, SendMessageOptions)

Comments

  • Your code has nothing to do with RandomMatchmaking.js, line 23, right?
    Have a look at what's happening in that code. You seem to be passing in some null reference instead of a game object.
Sign In or Register to comment.