Thursday, July 7, 2022
HomeGame Developmentunity - Entry a variable on an object hit by a ray

unity – Entry a variable on an object hit by a ray


So, I do know that there are higher methods to entry a variable on one other object, however this manner, so far as i do know, must be accessed on this particular manner. What I must do is get a variable on an object when that object is hit by a ray. One thing like GetComponent however for a variable. Ive already received the ray in a position to spawn and test if the item the ray hit has the script with the variable in it, i simply must entry the variable.

I cant actually set this up within the inspector, because the variable i would like is on one thing that there are various of, so i must get the variable from the precise object that was hit by the ray.

Ive been researching it for awhile but it surely appears all the opposite questions are both not what im searching for or simply outdated. I dont actually suppose posting any code would assist on this case, as what i’ve presently does every little thing besides what im asking about right here.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments