Skip to content

Instantly share code, notes, and snippets.

@unity3dcollege
Created January 31, 2018 21:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save unity3dcollege/4c035c89abfa72ca1302e77f6b900c4e to your computer and use it in GitHub Desktop.
Save unity3dcollege/4c035c89abfa72ca1302e77f6b900c4e to your computer and use it in GitHub Desktop.
using UnityEngine;
public class Character : MonoBehaviour
{
[SerializeField]
private Transform rightHand;
private GameObject currentWeapon;
public void EquipWeapon(GameObject weaponPrefab)
{
if (currentWeapon != null)
Destroy(currentWeapon);
currentWeapon = Instantiate(weaponPrefab, rightHand);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment