instantiating problem???
Does enyone know whats wrong or how to fix this??? this is for spawning my scene objects that could take damage. yes it is for multiplayer so i think its better to instantiate them but im getting a red line on the line instantiate. thanks!!
error 1 : Assets/Spawn SceneObjects.cs(11,21): error CS0120: An object reference is required to access non-static member UnityEngine.NetworkView.RPC(string, UnityEngine.RPCMode, params object[])' --------------------------------------------------------------------------------------------- ***error 2 : Assets/Spawn SceneObjects.cs(21,57): error CS1501: No overload for method Instantiate' takes `1' arguments*** 
 using UnityEngine;
 using System.Collections;
 
 public class SpawnSceneObjects : MonoBehaviour {
 
     GameObject gameObject;
 
     // Use this for initialization
     [RPC]
     void Start() {
         NetworkView.RPC("SpawnMyPlayer", RPCMode.AllBuffered);
     }
     [RPC]
     public void SpawnMyPlayer()
     {
         if (PhotonNetwork.isMasterClient) PhotonNetwork.Instantiate(gameObject);
     }
 }
@ Jessespike
Answer by Natesiteweb · Jan 19, 2016 at 09:21 PM
Hi, I haven't used Photon in a while so I'm a little rusty. If I remember correctly, you have to assign a position, rotation and group ID to the instantiated gameObject. Ex. PhotonNetwork.Instantiate(gameObject, new Vector3(0f, 0f, 0f), Quaternion.identity, 0);(Sets position and rotation to center of the scene.)
Answer by Jessespike · Jan 19, 2016 at 06:42 PM
You didn't specify wether this was for networks or not. Try replacing PhotonNetwork.Instantiate() with GameObject.Instantiate()
If it is for networks, then shouldn't the function be a RPC?
  [RPC}
  public void SpawnMyPlayer()
  { 
       if (PhotonNetwork.isMasterClient) PhotonNetwork.Instantiate(gameObject);
  }
Perhaps, it should be InstantiateSceneObject instead.
Either case, post your error and provide more details on your intent.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                