I’m not talking about when the object is clicked on, just when the mouse is clicked while in the game. I got the standard FpsController from importation to act as my player and put some spheres in front of the player to represent fists or hands (Mii style) but I am having a hard time moving them with code as I am an absolute beginner. The code is suppose to move the hand 1 unit on the z axis as a test for punching with the hand, but it is not doing anything atm.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HandMove : MonoBehaviour {
public GameObject Hand;
void OnMouseDown (){
Hand.transform.position = new Vector3 (0, 0, 1);
}
}