error CS1501: No overload for method `Instantiate' takes `1' arguments

I have no idea what this error is :smiley:
using UnityEngine;
using System.Collections;

public class AI_MachGunsFire : MonoBehaviour {
	
	
	public float NextFire =0.0f;
	public float MachineGunFireRate = 40;
	public float GunsActivate = 1;
	public GameObject MachGuns;
	
	public void Update () { 
		if(enemeyfighterrange.IsFireing > GunsActivate){
			NextFire = Time.time + MachineGunFireRate; //fire rate
		MachGuns = PhotonNetwork.Instantiate(Resources.Load("MachineGuns")); //instantsiate gunfire over network...	
			//fire machine gund when in range of User, at short burst...
		
		}
	} // end of update....

} // end of class....

photon networks instantiate takes at least 4 arguments, something like this:

PhotonNetwork.Instantiate("MachineGuns", transform.position, transform.rotation, 0)

Markup:

static GameObject PhotonNetwork.Instantiate (
string prefabName,
Vector3 position,
Quaternion rotation,
int group )

More details here:
http://doc-api.exitgames.com/en/onpremise/current/pun/doc/class_photon_network.html#a843d9f62d28ab123c83291c1e6bb857d

The Instantiate method requires either the following parameters
“string prefabName, Vector3 position, Quaternion rotation, int group”
Or
“string prefabName, Vector3 position, Quaternion rotation, int group, object data”

Here is a link to the class reference:
http://doc-api.exitgames.com/en/onpremise/current/pun/doc/class_photon_network.html#a843d9f62d28ab123c83291c1e6bb857d

This error is caused, because Instantiate method requires 3 parameters: (gameObject, position, rotation). As I can see, you’re using only one parameter, you also have to set position, and rotation.
Try this:

MachGuns = PhotonNetwork.Instantiate(Resources.Load("MachineGuns"), transform.position, Quaternion.identity)

It will instantiate object at the position of gameObject you’re using, and set its rotation to: no rotation.

Hello zak666

you are getting this error because photon instantiation takes 3 parameters String name, Vector3 position, Quaternion rotation. Here’s your corrected code

public class AI_MachGunsFire : MonoBehaviour {
     
     
     public float NextFire =0.0f;
     public float MachineGunFireRate = 40;
     public float GunsActivate = 1;
     public GameObject MachGuns;
     
     public void Update () { 
         if(enemeyfighterrange.IsFireing > GunsActivate){
             NextFire = Time.time + MachineGunFireRate; //fire rate

             //Only provide the name as a string
             MachGuns = PhotonNetwork.Instantiate("MachineGuns", Vector3.zero, Quaternion.identity); //instantsiate gunfire over network...  
  
             //fire machine gund when in range of User, at short burst...
         
         }
     } // end of update....
 
 } // end of class....

Regards Faizan

cannot use inspector for instantiate becouse fighters are being insted by carriers why need to use reasorces .load