Accesing The Script Under GameObject
Hi everyone,
I'm trying to make a shooting system with different weapons. I made weapon switch system. Which I have guns under gun holder game object 
and setting active another weapon on change. Thats OK. But I have some trouble;
I have weapon variables in a script attached to the gun: 
Inside that script;
 public class WeaponData : MonoBehaviour
 {
     [SerializeField]
     GameObject bulletPrefab;
     [SerializeField]
     public Transform weaponTip;
     [SerializeField]
     SpriteRenderer muzzleFlashRend;
 
     public float fireRate = 5f;
     public float damage = 25f;
     public LayerMask whatToHit;
     public float range = 100f;
     public float hitForce = 300f;
 
     public GameObject kan;
     public GameObject kivilcim;
 
     float timeFire = 0;
 }
 
 
               In another script I'm trying to make shooting function. So I'm defining some variables to use (in Shoot script);
     GameObject bulletPrefab;
     public Transform weaponTip;
     SpriteRenderer muzzleFlashRend;
 
               But I want to set the bulletPrefab variable to active weapon's bulletPrefab variable on that weapon's WeaponData script. How can I get that specific variables on a weapons script?
Current weapon is defined by;
 weapScript.guns[weapScript.CurWeaponIdx].GetComponent<WeaponData>();
 
              Your answer
 
             Follow this Question
Related Questions
Unity Sprite renderer bug?? 0 Answers
Walking around 2D planets? 1 Answer
Player controlled platforms 0 Answers
[2D] Rigid body snaps through floor and back 1 Answer
Cannot get my double jump to work (2D) , 0 Answers