How do I get a JS editor script to recognize a C# class? (They are in the proper folders)

Googling sometimes helps. Sometimes, though, it only returns a lot of very popular answers that don’t quite fit the bill :slight_smile:

I have a lot of C# classes, and I need to use a JS only function, Eval(), but unfortunately the JS file needs to access the classes. I have the files in the proper folders. However, I’m not sure how to ensure the JS file works with the class.

function RenameCategory(master : Master, code : String){
        print ("Code To Run: " + code);
        eval(code);
    }

That returns the error "The name 'Master' does not denote a valid type ('not found'). "

Does anyone know what i need to do other than put them in the proper folders?

When you say “in the proper folders”, what folders are those?

What do you need eval for?

https://forum.unity3d.com/threads/is-there-a-way-to-replace-names-in-a-class-structure-code-idk-the-right-terms-to-use-here.461624/#post-2999464

There is a cheap asset on the store that implements eval in C#. You could always give that a shot instead of JS.

Outside of that the only thing I’m aware of when using JS with C# is simply placing them in seperate folders.

1 Like

Or put your C# script in a /Plugins folder which will make it compile earlier and your JS will be able to see it.

1 Like

Already done that – however, I think doing the JS version isn’t actually the better option.

1 Like