- Home /
Question by
conguerror · Jan 19, 2020 at 03:12 PM ·
spawnpoints
Attach weapon to hand
As always there are bugs everywhere. Weapons are spawning, but not in a way I wanted. How can I fix it? Relevant code:
public class Pickup : MonoBehaviour
{
public Transform rightHandTransform = null;
public Transform leftHandTransform = null;
public WeaponScriptableObject weapon = null;
private void OnTriggerStay(Collider other)
{
if (other.tag == "Player")
{
if (Input.GetKeyDown(KeyCode.E))
{
weapon.SpawnWeapon(rightHandTransform, leftHandTransform, other.GetComponent<Animator>());
}
if (rightHandTransform == null || leftHandTransform == null)
{
Debug.LogError("RightHandTransform or LeftHandTransform are not assigned");
}
// Destroy(other.gameObject);
}
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612221806im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Different spawn spots in Multiplayer 1 Answer
Instantiate script crashes unity 3 Answers
Random spawnpoint where only one prefab can spawn! 1 Answer
Don't spawn if spawn point is in use 1 Answer