Hi, i have a problem…
NullReferenceException: Object reference not set to an instance of an object
SnakeMovement.SpawnOrbFromHead (Vector3 finalPosition_, Int32 randomNum_) (at Assets/Snake.io/Scripts/SnakeMovement.cs:80)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[ ] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[ ] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[ ] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
NetworkingPeer.ExecuteRpc (ExitGames.Client.Photon.Hashtable rpcData, .PhotonPlayer sender) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2882)
NetworkingPeer.RPC (.PhotonView view, System.String methodName, PhotonTargets target, .PhotonPlayer player, Boolean encrypt, System.Object[ ] parameters) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:3725)
PhotonNetwork.RPC (.PhotonView view, System.String methodName, PhotonTargets target, Boolean encrypt, System.Object[ ] parameters) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:2915)
PhotonView.RPC (System.String methodName, PhotonTargets target, System.Object[ ] parameters) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonView.cs:597)
SnakeMovement+c__Iterator0.MoveNext () (at Assets/Snake.io/Scripts/SnakeMovement.cs:65)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
This is the code
[PunRPC]
void SpawnOrbFromHead(Vector3 finalPosition_, int randomNum_){
GameObject newOrb = Instantiate(orbPrefab, finalPosition_, Quaternion.identity) as GameObject;
newOrb.transform.name = randomNum_.ToString();
GameObject orbParent = GameObject.Find(“Orbs”);
newOrb.transform.parent = orbParent.transform;
}