Hey I tried a quick google search with no luck. Everything was about how to write scripts or access things in scripts. I have a laser beam that is created during the game and I was wondering if when I create the cylinder, aka laser, if I could also create a script to use the cylinder’s capsule collider to detect a collision with an object such as a player or wall. Any other time I have used OnCollisionEnter, Exit, or Stay, the script has had to be attached to the object in this case the laser. So I was wondering if it is possible to create a script with a script or attach a script to a gameobject in a script. This way when the laser shoots I can just do one of the previously mentioned.
I know I could use an empty then attach the cylinder and then play with the alpha channel, or mesh renderer to turn the laser on and off; and if I can not create the script then this is probably what I will do, unless anyone has any better suggestions.
If you manage to get an answer through a google search, I am sorry my googlefoo is weak.