I'm trying to access the other script but doesnt work

When I get a weapon from the ground, I want that weapon to enter weapons [0]. but doesnt work

this first gun script
public Transform me;
public static GameObject gun;
public bool distance1;
void Start(){
}
void Update(){
if(Vector3.Distance(transform.position,me.position)< 2.5f){
mesafe1=true;
}
if(distance1 && Input.GetKey(KeyCode.F)){

gun=Grevyard.weapons[0];
}

public Transform me
public static GameObject gun1;
public bool distance1;

void Start(){
}
void Update(){
if(Vector3.Distance(transform.position,me.position)< 2.5f){
distance1=true;
}
if(distance1&& Input.GetKey(KeyCode.F)){
gun1=Grevyard.weapons[1];

public static GameObject[ ] weapons;
private GameObject current;
void Start(){
}
void Update(){
}
void silahlar(){
if(Input.GetKey(KeyCode.Alpha1)){
weapons[0].SetActive(true);
weapons[1].SetActive(false);
current=weapons[1];
}
if(Input.GetKey(KeyCode.Alpha2)){
weapons[0].SetActive(false);
weapons[1].SetActive(true);
current=weapons[2];
}

these are 3 different scripts last one for inventory and other ones for each guns

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

How to understand compiler and other errors and even fix them yourself:

https://discussions.unity.com/t/824586/8

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: https://discussions.unity.com/t/481379

1 Like

there is no answer for me at these posts I just want to know how can i add GameObject to array from other script