-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow using Unity script templates in Rider #232
Comments
in unity, there are just 2 default script templates and it's for the basic MonoBehaviour and ScriptableObject there is also free asset made by unity but it's outdated so it shows error and you need to install it after you create projects so it's pretty annoying and I stopped to use it a long time ago I also made class creator but similar problem - need to install it to every new project also you can make your own templates and put them together with the default but the problem is, it's in unity installation directory for example "c:\Program Files\Unity20171p1\Editor\Data\Resources\ScriptTemplates.." and that's bad ... if you do need update unity often (and it's actually everybody who's not finishing huge project) ... then you just resign on that anyway as dev you mostly need the MonoBehaviour and the ScriptableObject and we can type so why do I bother, right? :D BUT if you need Editor or EditorWindow you have to do it from the scratch and if you don't make tools on daily basis you need to go to reference and just copy it what unity needs is possibility to create scripts from template stored elsewhere then in the installation folder and actually the best way to create scripts is outside of unity because unity recompiles the project after you change something in it so the way of creating scripts in IDE is the best, because you create script, name and edit it and then save and switch to unity to recompile unityVS can create scripts but also just MonoBehaviour and ScriptableObject (even if they claim it's editor script, it's SO) ... what I expect from the template is:
|
@jcx Thanks much! |
I thought about it and I guess my idea is pretty complicated for the usual user. The way I am thinking we could get to UML and it's completely different topic. I guess the usual templates would work just fine and all I need is more of them than just the 2 basic runtime classes. |
I've made a start supporting ReSharper's templates in Unity - see #237. It doesn't quite match what's here, but it's a good start. For example, ReSharper's templates are available in Rider, but there isn't a UI to edit and customise them yet. They also don't have the ability to start a wizard, so the idea of choosing what methods to implement won't work - but it will create a script, and position you where you can then invoke the generate menu and generate the methods you need. I'm planning on recreating the existing Unity templates first, as listed in the PR. But once the infrastructure is in place, we can customise them, e.g. by creating a "Unity Script", you could get a C# file where the classname matches the filename, and then gives you an editable base class, with a drop down of classes that derive from But looking at the requirement for attributes, would this be better with a context action (i.e. hit Alt+Enter on an existing class name)? This could be an action on a type name that shows "Create CustomEditor" and it would create a new class in the same file, and add a Not sure what you'd need for |
The problem with editor classes is they have to be in Editor directory, you can have more of them but basically, it's a different project. I saw editors scripts outside of the Editor directory but it might confuse teammates. for EditorWindow you need just ... and maybe some selectable methods like OnFocus/OnLostFocus OnHierarchyChange etc. |
The next Rider 2017.2 build will include some Unity file templates, based on the default Unity templates. You can see them here. There are a couple of limitations with this first version - Rider doesn't yet have a UI for editing the templates, although you will be able to edit them with ReSharper. And secondly, there's an issue with grouping - a template for use in the Would appreciate feedback once it's available (probably next week). I'm going to close this issue for now. Feel free to create new issues about the new templates, or suggestions, etc. |
good start, at least one doesn't need to go to unity, create, rename, wait for refresh (big project = long refresh) just to be able to type code to empty class thanks guys |
We need some understanding if ppl use them outside UnityEditor.
Maybe we can provide them/similar directly in Rider?
Also people may need a helper to update Unity templates or just help to find where are they located.
The text was updated successfully, but these errors were encountered: