- Home /
Changing a Variable within the same script
Hey there i am attempting to create a system where clicking another in-game object will have the camera target that object , the targeting system has already been set up but i need to know how i would go about telling the script to change that variable to target the new object , i 've already set up a Raycast system that checks for the tag of the object each object has the same tag "Cell" , all i need to know is how i can tell the system to change the target to the name of the object my ray cast picks up.
RaycastHit vHit = new RaycastHit(); Ray vRay = Camera.main.ScreenPointToRay(Input.mousePosition); if (vHit.transform.gameObject.tag == "Cell" && Input.GetMouseButtonDown(1)) {
}
Thanks for your time and patience.
Your answer
Follow this Question
Related Questions
Mouseclick GameObject through the view of a RenderTexture 0 Answers
2D Raycast in any direction 1 Answer
why doesn't this Raycast compare tag work? C# 2 Answers
C# change an object tag wit raycasthit. 2 Answers
Multiple Cars not working 1 Answer