Becuase if answers not working because of google captcha i posting it here
Hi iam making and inventory pickup system
my inventory script holding ammo and of player has the gun
using System.Collections;
using UnityEngine;
public class WeaponScr : MonoBehaviour {
// Use this for initialization
public int ammo;
public bool isOwn;
}
and pickup script that toggle the isOwn to true and another to add 40 rounds to ammo
but it isnt working
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Pickup : MonoBehaviour {
public playerScript WeaponsScr;
public GameObject WeaponItem;
void Update()
{
// Rotate the object around its local X axis at 1 degree per second
transform.Rotate(0,50*Time.deltaTime,0);
}
void OnTriggerEnter(Collider other) {
WeaponsScr playerScript = WeaponItem.GetComponent(“WeaponScr”);
playerScript.isOwn = true;
Destroy(gameObject);
}
}
can someone fix it and somehow explain me how to add 40 to the ammo varible?