using System.Collections; using System.Collections.Generic; using UnityEngine; public class PicXFS : MonoBehaviour { public GameObject Hand; // Start is called before the first frame update void Start() { } public void picXFS() { if(XFS.instance.gun==null) return; XFS.instance.gun.transform.SetParent(this.transform.parent); XFS.instance.gun.transform.position=this.transform.position; } public void pickXFS() { XFS.instance.gun.transform.SetParent(Hand.transform); XFS.instance.gun.transform.localPosition = new Vector3(0, 0, 0); } // Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Q)) { picXFS(); } if (Input.GetKeyDown(KeyCode.F)) { pickXFS(); } } }