InputSystem icon indicating copy to clipboard operation
InputSystem copied to clipboard

Add a way to generate a C# class in a path relative to its input actions asset

Open Ramobo opened this issue 7 years ago • 7 comments

Right now, the only way that I could find of generating a C# class in a folder outside of the assets folder ~~--~~ packages, in this case ~~--~~ is by providing an absolute path, which won't work unless the package user has their project in the exact same folder as you.

Ramobo avatar Jun 09 '19 15:06 Ramobo

There is really no good reason to store generated C# class outside Assets folder. Please let us know the reason behind it, so we can evaluate a design change.

JiaUnity avatar Jun 14 '19 22:06 JiaUnity

As I mentioned, this can be used for packages. You could generate it in the assets folder and then move it to your package folder, but it's a nice quality of life feature to have the possibility to generate it in a path relative to the input actions asset.

Ramobo avatar Jun 16 '19 13:06 Ramobo

Oh right, packages. Yeah, agree it should handle that and default to just placing it alongside the .inputactions file wherever it is.

Not a fix but relative paths should still work ("../Packages/.."). Minus the bug on Windows where it does "Assets/Assets" (will be fixed in next package).

Rene-Damm avatar Jun 20 '19 14:06 Rene-Damm

I did try relative paths before, which didn't work. I tried it again now with "../Scripts/Input.cs" and "/../Scripts/Input.cs", neither of which are working. The file just doesn't generate. No errors.

Ramobo avatar Jun 22 '19 00:06 Ramobo

I just realized that using a relative path like above caused the script to be generated at "C:\Scripts\Input.cs".

Ramobo avatar Jun 24 '19 22:06 Ramobo

Should be addressed in https://github.com/Unity-Technologies/InputSystem/pull/722. Starting the path with either ./ or ../ (backslashes are fine, too) will make it relative to the location of the .inputactions file.

Rene-Damm avatar Jul 12 '19 16:07 Rene-Damm

I can confirm that it's working in 0.9.0-preview.

Ramobo avatar Jul 22 '19 19:07 Ramobo