Heya, noob coder here, trying to make some laser weapons for a spaceship, but running into issues

For context, I was using the above tutorial.
my current code:

the issues:

script in inspector:
9136870--1268959--upload_2023-7-10_15-15-59.png
unsure if needed, but script was keyed to the sideweapons tab
9136870--1268965--upload_2023-7-10_15-16-16.png

  1. Use code tags
  2. Read what the error says. The variable does not exist. If you double click it it will take you to the line where the typo is. You also added a space after the . which might give issues.
  3. The inspector wont load with errors, since the code wont compile

I double-clicked what you said, it keeps bringing me back to line 16, which is an empty line

That’s a bit weird, check line 38

yeah, removed that instance of muzzlePoint and it immediately fixed it, ty!

1 Like

Line 38 should be:

_beam.SetPosition(1,hitPosition);

Also, make sure the script name matches the class name - sidelaser.

Finally, try restarting Unity to fix the layout issue.

1 Like