Reference a JS script in a C# script?

Hi, I have a (modified) ThirdPersonController.js script that I want to reference in another script, Cheats.cs, which is coded in C#. When I try to reference the JS script (which is inside my Player) it doesn’t appear like the CharacterController does, I’ve looked round the forums and nothing helped. It acts like the ThirdPersonController doesn’t exist.

I have 2 theories to why this might be happening:

  1. C# can not access JS scripts.
  2. You can not reference a script, only a component.

I’m more inclined to believe in the first one. I’m happy to explain this further if you don’t understand some of it.

This worked for me :

Create a folder named Plugins in the main Assets folder and put your script in there, then unity should recognise it and will allow you to access it from other scripts.

I hope it works for you too.

Good luck.

Sadly, your first theory is correct. I’ve tried almost every possible way to connect them, but to no avail. Your best bet would be to convert the JS to C#. If it’s not incredibly complex I can help. I’ve gotten fairly good at converting JS to C#.