|
I am setting up a selection system like one you might see in an RTS game. Having said that, I have a slection script to be placed on every selectable prefab/gameobject. Inside this script i have a function SetSelect(). What I am trying to do is raycast to the object, then call that object's SetSelect function. Shouldn't I be able to say:
I would THINK so. Maybe I'm thinking all wrong. Anyway it doesn't call the function. I'm not sure why.
(comments are locked)
|
|
Before you can access the raycasthitinfo object you need to actually cast a ray. Your script needs some more lines
Read the scripting reference for futher information.
(comments are locked)
|
|
It may have to do with when or how you are getting your GameObject or when or where you are calling the functions or even just how you're testing whether the function is being called. Without more information like a more complete section of script, it is impossible to guess. I just tested this setup and it works: CameraPicker.js
Selectable.js
If this does not address your issue, please include more information as it is likely some other part of your script that is not behaving as you expect.
(comments are locked)
|
