Created
January 31, 2018 21:09
-
-
Save unity3dcollege/4c035c89abfa72ca1302e77f6b900c4e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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