Git Product home page Git Product logo

resharper-unity's Introduction

official JetBrains project Build status Build Status Join the chat at https://gitter.im/JetBrains/resharper-unity

Unity Support for ReSharper and Rider

The "Unity Support" plugin adds specific functionality for the Unity game engine to ReSharper and Rider.

Rider is JetBrains' cross platform .NET IDE, based on ReSharper and the IntelliJ Platform. It can be used on Windows, Mac and Linux and this plugin can replace the default MonoDevelop editor with an IDE providing rich code navigation, inspections and refactorings.

The plugin adds code completion and generation of Unity event functions, inspections for common errors, quick fixes, support for .shader files, automatic handling of .meta files and more. The Rider plugin includes additional support for attaching the debugger to the Editor instance and a Unity Editor plugin to improve integration.

Installation 2019.2+ with Rider package

In Unity choose Rider as External Editor in Unity settings.

For uninstall choose a different External Editor in Unity settings.

Installation 2019.1-

This plugin comes bundled with Rider, and manual installation is not required. However, it is necessary to configure Unity to use Rider as the external script editor:

  • Check if .sln file is present:
    • Start Rider and open the .sln file. Rider will install a Unity Editor plugin into the project (see below for more details)
    • Otherwise, start Rider and open project folder in Rider. Rider will show Notification, which allows to install Unity Editor plugin.
  • Switch back to the Unity Editor, with the same Unity project open. The new Unity Editor plugin will automatically configure Rider as the external script editor.

This only needs to be done once, and can also be done manually, via the Unity Editor's External Editor Preference pane.

Double clicking on C# scripts and .shader files will now automatically open Rider, load the solution and navigate to the file. More file types can be associated with Rider by editing Additional extensions in the Edit → Project Settings → Editor settings pane.

The solution can be loaded directly with the Assets → Open C# Project menu item.

Note that Rider will add an Assets → Open C# Project in Rider menu item for older versions of Unity. This is because prior to 2017.1, the Unity Editor doesn't recognise Rider as an editor that can load C# solutions, and will also launch MonoDevelop. Other than not launching MonoDevelop, these menu items are identical.

Rider will install the Unity Editor plugin in each Unity project it opens. See below for more details.

For uninstall choose a different external Editor in Unity settings, delete Editor plugin from your project.

ReSharper plugin installation

The ReSharper plugin is installed via the ReSharper → Extension Manager. Simply search for "Unity Support".

Features

Unity API knowledge:

  • The plugin knows about all Unity based classes (MonoBehaviour, ScriptableObject, EditorWindow, etc.) and their event functions via analysis of the Unity API surface and documentation.
  • Support for Unity API starting from 5.0.

Event functions:

  • Event functions and fields implicitly used by Unity are marked with an icon in the gutter.

  • Empty event functions are marked as dead code, with a Quick Fix to remove the method.

  • When Solution Wide Analysis is enabled, implicitly used fields and event functions are marked as in use. Fields are highlighted if they aren't accessed in your code.

  • A new "Generate Unity event function" menu item is added to the Alt+Insert Generate Code menu, to generate event functions via GUI. This action is also available from Alt+Enter on a Unity based class's name.

  • Auto complete will suggest event function names when declaring methods in Unity based classes, and expand to include method signature. Simply start typing an event function within a class deriving from a known Unity class, such as MonoBehaviour.

  • Incorrect method signatures and return types are shown as warnings, with a Quick Fix to create the correct signature.

  • Optional parameters are called out in a tooltip, and marked as unused if not used in the body of the method, e.g. OnCollisionEnter(Collision collision).

  • Suppress naming consistency warnings for known Unity event functions. E.g. ReSharper no longer suggests that AnimatorIK be renamed to AnimatorIk.

  • Descriptions for event functions and parameters in Unity based classes are shown in tooltips and QuickDoc. To show the information in tooltips, ReSharper's "Colour identifiers" and "Replace Visual Studio tooltips" setting must be enabled (search for them in settings). Alternatively, use the excellent Enhanced Tooltip plugin.

  • "Read more" in QuickDoc will navigate to the Unity API documentation, locally if available, or via the Unity website.

Coroutines and invokable methods:

  • Event functions that can be coroutines are called out in tooltips.

  • Context Action on methods that can be coroutines to convert method signature to/from coroutine.

  • Warnings for unused coroutine return values.

  • Code completion, find usages and rename support for string literals in MonoBehaviour.Invoke, IsInvoking, InvokeRepeating and CancelInvoke. Also supports StartCoroutine and StopCoroutine and understands overloads here.

Networking:

  • Code completion, find usages and rename support for string literals in [SyncVar(hook = "OnValueChanged")].
  • Highlight usage of SyncVarAttribute in any class other than NetworkBehaviour as an error.

Inspections and Quick Fixes:

  • Empty event functions are shown as dead code, with a quick fix to remove the method.

  • Using the SyncVarAttribute inside any class other than NetworkBehaviour is treated as an error.

  • Inspection and Quick Fix to use CompareTag instead of string comparison.

  • "Create serialized field" from usage of unresolved symbol.

  • Inspections and Quick Fixes for incorrect event function signatures and return types.

  • Inspections and Quick Fixes for incorrect method or static constructor signatures for InitializeOnLoad attributes.

  • Inspections for incorrectly calling new on a MonoBehaviour or ScriptableObject. Quick Fixes will convert to calls to GameObject.AddComponent<T>() and ScriptableObject.CreateInstance<T>().

  • Inspection for unused coroutine return value.

ShaderLab support:

Initial support for ShaderLab syntax in .shader files, with limited support for Cg/HLSL blocks.

ShaderLab:

  • Syntax and syntax error highlighting for ShaderLab syntax.

  • Colours highlighting and editing.

    Also available in Rider:

  • Rider includes simple word based completion (so called "hippie completion"). This provides completion based on words found in the current file. This is not available in ReSharper.

  • Brace matching and highlighting, comment/uncomment, and to-do explorer support.

  • Code folding in Rider.

Cg/HLSL (Rider only):

  • Syntax highlighting for CGPROGRAM/CGINCLUDE blocks and .cginc files. Currently no syntax error highlighting.

  • Simple word based completion (so called "hippie completion").

External Annotations:

See the ReSharper help for more details on External Annotations.

  • Treat code marked with attributes from UnityEngine.dll, UnityEngine.Networking.dll and UnityEditor.dll as implicitly used.
  • Mark Component.gameObject and Object.name as not-nullable.
  • Debug.Assert marked as assertion method to help null-value analysis (e.g. "value cannot be null" after Debug.Assert(x != null))
  • Debug.AssertFormat, LogFormat, etc. gets string formatting helper functionality.
  • Assertions.Assert methods marked as assertion methods to help null-value analysis.
  • EditorTestsWithLogParser.ExpectLogLineRegex gets regular expression helper functionality.
  • Various attributes now require the class they are applied to derive from a specific base type. E.g. [CustomEditor] requires a base class of Editor).
  • Support for Unity 2017.2's modularised UnityEngine assemblies.

Project and File Templates:

  • Project template Unity Class Library *

    Essentially it is a Class Library with reference to UnityEngine.dll

  • File templates for new C# script, tests and shader files.

    Also available in Rider:

  • Support for editing and creating File Templates and Live Templates for Unity projects in ReSharper. Note that Rider currently doesn't support editing File and Live Templates. This is planned for Rider 2017.3)

Other:

  • Synchronise .meta files on creation, deletion, rename and refactoring.

  • Automatically sets correct C# language version, if not already specified in .csproj - ReSharper will no longer suggest code fixes that won't compile! Supports the default C# 4 compiler, Unity 5.5's optional C# 6 compiler and the C# 6/7.0 compiler in the CSharp60Support plugin.

  • Disables the Assets and Assets\Scripts folders from being considered as "namespace providers". This means ReSharper will no longer suggest to include Assets or Scripts in the namespace of your code.

  • Support for UnityEngine.Color and UnityEngine.Color32. The colour is highlighted, and hitting Alt+Enter will open the colour palette editor to modify the colour. Also supports named colours and Color.HSVToRGB.

Rider specific functionality

The plugin also adds some functionality just for Rider:

  • The Library and Temp folders are automatically excluded from Rider's full text search, used for the "Find in Path" feature. These folders can become very large, and can take a long time to index if not excluded.

  • Rider will automatically create an "Attach to Unity Editor" run configuration. When the debug button is clicked, Rider will automatically attach to the editor and start debugging. Rider will look for a Library/EditorInstance.json file, created by Unity 2017.1, or by EditorPlugin. If the file doesn't exist and only a single instance of Unity is running, Rider will attach to this instance. If multiple instances are running, Rider will prompt for which instance to attach to.

  • Rider will install a Unity Editor plugin whenever a Unity project is opened. See below for more details.

Please suggest new features in the issues!

Unity Editor plugin

For Unity 2019.2+ with Rider package Editor plugin is loaded directly from Rider installation.

By default, when Rider opens a Unity project, it will automatically install a Unity Editor plugin, and keep it up to date with new versions. This behaviour can be disabled in Rider's Preferences → Languages & Frameworks → Unity Engine.

This plugin does the following:

  • Automatically set Rider as the default external script editor.
  • Ensure the C# solution and project files are up to date, and make minor changes required by Rider:
    • Attempts to set appropriate TargetFrameworkVersion. This is customizable in Preferences. Note that this affects how Rider resolves references, and does not change how Unity builds a project.
    • Set the LangVersion correctly, so that Rider does not suggest C# 6 features when Unity is targeting C# 4, or C# 7 features when Unity is targeting C# 6.
    • Add references to UnityEditor.iOS.Extensions.Xcode.dll and UnityEditor.iOS.Extensions.Common.dll, which are referenced when Unity builds, but not included in the generated project files.
    • Add options defined in mcs.rsp or smcs.rsp and gmcs.rsp files, such as conditional compilation defines, the unsafe keyword and [references(#270)]. Adding them to the project file makes the information available to Rider's analysis.
  • Use interprocess communication to speed up opening C# scripts, .shader files and text assets in Rider, if it's already running. It will launch Rider and load the solution if it isn't.
  • Add a Rider Preference pane:
    • Enable logging to the console for troubleshooting. Please use this before logging an issue.
    • Customize TargetFrameworkVersion for generated project files. Note that this only affects how Rider resolves references, and does not change how Unity builds a project.
  • Provide extra functionality for older versions of the Unity Editor (prior to Unity 2017.1):
    • Create a file called Library/EditorInstance.json that contains process information for debugging the Unity Editor. This file is created natively by Unity since 2017.1.
    • Add an Assets → Open C# Project in Rider menu item. Earlier versions of Unity do not recognise Rider as an editor that can correctly open solutions, and so will launch both Rider and MonoDevelop when the Assets → Open C# Project menu item is selected.

Rider will automatically add this plugin to all Unity projects that are opened. It will initially install the plugin to Assets/Plugins/Editor/JetBrains/JetBrains.Rider.Unity.Editor.Plugin.Repacked.dll, but will look for the file by name if it is moved.

Supported Unity versions: 5.0+

Roadmap

Check the milestones for plans, and please raise an issue with feature requests or bugs.

resharper-unity's People

Contributors

alexpl292 avatar arseniicherniaev avatar artemiyaaa avatar citizenmatt avatar controlflow avatar denis417 avatar derigel23 avatar esolovova avatar evgsha avatar fornever avatar hypersw avatar iliya-usov avatar ivanpashchenko avatar jurjenbiewenga avatar konstantin343 avatar krasnotsvetov avatar kskrygan avatar mfilippov avatar mirasrael avatar mmazurkevich avatar mtoolmakerjb avatar nicklyu avatar rwx788 avatar shalupov avatar smertig avatar tutushkin avatar van800 avatar vinhui avatar xtmq avatar yole avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

resharper-unity's Issues

Feature request: Support for source-control when renaming classes

  • Unity uses special .meta files for all assets when it used with source control.
  • MonoBehaviours and other script types in Unity require the file name to match the class name.
  • ReSharper is helpful: 'Refactor-Rename class' has option to rename files

Not so helpful: It doesn't know about .meta files. So when a file is renamed outside of the Unity Editor it will detect the change as a delete/add and not a rename/move. (I'm guessing this is more of a Unity Tools for VS/VS issue rather than a ReSharper issue.)

A partial fix for this, which I think will be good enough is to make sure to also rename the .meta files as otherwise Unity will generate a new meta file for the "new" script file (with a new GUID).

When that happens all script references to the renamed script file in scenes and on prefabs will become invalid because they still reference the old meta file (GUID) but no script file exists for it anymore...

P.S:
A "total" fix might be possible because Unity exposes an API for interacting with source control but it is probably too much of a hassle to get it to work correctly, maintain it and for it to still be user friendly. Because it would require the plugin to call into the Unity process and wait on a async task to finish which may or may not complete successfully depending on connectivity to source control or the source control state of the file ("added but not pushed", "not checked out" etc.) i.e. a can of worms...

Disable warning 649 on fields with SerializeFieldAttribute

To skip "field is newer assigned" warning with private fields with SerializeField (assigned via inspector) I had to flood my code with "#pragma warning disable 649" and "#pragma warning restore 649". Will be good to skip this warning somehow if possible

Disable forcing C# 5 for Unity 5.5

The extension sets ReSharper's C# language level to C# 5, as existing versions of Unity don't support C# 6. Unity 5.5 will target .net 4.6 and use the C# 6 compiler, so we shouldn't change language level in this case.

  • How do we decide this? Based on version of unity assemblies?
  • The article describes changing the target to .net 4.6 - is there a flag in the project file for this?
  • Should we still set it for older Unity versions?

Type Argument Specification Is Redundant

It seems whatever compiler Unity uses is not capable of inferring types in generics when passing in method groups.

For example:

    public class Foo
    {
        private Dictionary<Type, Func<string, object>> funcs = new Dictionary<Type, Func<string, object>>();

        public void AddFunc<T>(Func<string, T> func)
        {
            funcs.Add(typeof(T), (name) => func(name));
        }

        public Foo()
        {
            AddFunc(PlayerPrefs.GetString);
        }
    }

This is valid code, but does not compile in Unity because it seems incapable of deciding between the overloads of PlayerPrefs.GetString(string key) and PlayerPrefs.GetString(string key, string defaultValue)... probably a low priority bug in their mono compiler that's never been addressed.

Specifying the <string> directly gets it to compile eg: AddFunc<string>(PlayerPrefs.GetString), but then R# flags this argument specification as redundant.

Its not appearing the resharper extension manager

Hey,
sadly it does not show up the extension manager.
I am using the newest version of Resharper 9.2 and the bundeled vs Studio version 2015 community.
I would like to try out the extension. Sounds very helpful.
Greetings

SerializeFieldAttribute treatment

In Unity its a common case to use private instance field (field type dosen matter) with SerializeFieldAttribute.
This makes that field value be available for editing from Unity inspector and assigned value will be provided with Unity serializtion system.
But resharper tends to threat private fields with SerializeFieldAttribute as never assigned.
Even more, if such fields have a default initializer, resharper tends to make them const or readonly, which prevents them from being edited in Unity inspector.

Unity docs:
http://docs.unity3d.com/ScriptReference/SerializeField.html

So the suggestion is:
If a field have SerializeFieldAttribute never mark it as "never assigned" and never propose a "readonly" or "const" keywords into it.

Shared External Annotation file

Right now in order to share an ExternalAnnotation.xml file across my team we have to add the Library/UnityAssemblies/UnityEngine.ExternalAnnotations.xml file to version control. Is there any way we can add an external annotation file to this without having to add my Library folder to the repo?

Supress "Replace '?:'-operator with '??'" suggestion

Hello!

As Unity explains:

When you do this in Unity:
if (myGameObject == null) {}

It behaves inconsistently with the ?? operator, which also does a null check, but that one does a pure c# null check, and cannot be bypassed to call our custom null check.

Source: http://blogs.unity3d.com/2014/05/16/custom-operator-should-we-keep-it

This suggestion might mislead the programmer while comparing UnityEngine.Objects.
Would it be possible to supress it?

Thanks in advance!

PS. Huge thanks for this amazing utility 😄 !

Automatically set language level to C#5

Unity is compiled with mono, which doesn't support C#6, so ReSharper shouldn't use or suggest C#6 features, when running mono projects in VS2015.

The plugin should detect when a mono solution has been opened, and automatically set language level to C#5 for all projects.

Treat [SerializeField] fields as [UsedImplicitly]

Currently I get an "Unassigned field" warning on fields that are private but with a [SerializeField] attribute. These fields are set by Unity serialization. Marking them with [UsedImplicitly] fixes this and seems like the correct thing to do, but could perhaps also live in this plugin since it does a similar thing for e.g. Awake and Update on MonoBehaviour.

This is maybe more complex than it seems though since it would have to work not just MonoBehaviour and ScriptableObject fields, but on any fields in classes serialized by them. Just fields directly on those classes would be a good start though!

Expensive math operations as hints

Hint that Exp, Sin, Cos, Tan, Sqrt, Pow and even / and % are expensive, especially when inside of the Update method of a MonoBehaviour.

Rename Methods in Scene Files

When you have things like events tied to button clicks, they are embedded in the .unity (scene) file as strings. (see m_MethodName: in a text (not binary) scene file).

When Resharper suggests changing the method name in the .cs file, it should take into account any matches in scene files. If the method name is changed, R# should also change it in the scene file to keep them linked.

Set default C# level to 4, not 5

The plugin sets the default C# level to 5 rather than "default" (so VS2015 doesn't suggest C# 6 features), but Unity only supports C# 4. Unless the .csproj's <LangVersion> element says differently, override the current language version to 4.

Setting to allow disabling more "namespace providers"

It's probably a project specific issue so if it's hard to implement or you don't feel it should be part of the plugin just close it :)

Right now plugin disables Assets/Scripts from "namespace providers", but for example my project due to historic reasons (hello port from Java/Intellij Idea) has such code structure:
Aseets/Code/Module 1/src/"namespace included folders"
Aseets/Code/Module 2/src/"namespace included folders"
...

So if I could add some other folders to "disabled namespace providers list" either in some options or in some xml/ini file it would be awesome.

ReShader!

Better syntax highlighting and and code completion for Unity3D shaders. Extra points for adding in a way to view the results of said shader in a preview window.

Feature request: Add [FormerlySerializedAs($fieldName$)] attribute when using Refactor-Rename on serialized fields

Renaming serialized fields in Unity can result in loss of data/serialized references if they are not marked with a FormerlySerializedAs attribute to denote their previous names.

Ideally ReSharper should add it when doing a rename refactor, such that renaming both fields below...
beforerefactor
... would result in something like this:
afterrefactor

See https://docs.unity3d.com/ScriptReference/SerializeField.html for a list types that are serializable, though it is missing some info: Classes marked with the System.Serializable attribute can also be serialized (provided they contain serializable types)

If renaming a field that already has a FormerlySerializedAs attribute it should append add a new attribute
FormerlySerializedAs attribute (that is, is should not overwrite the existing one).

Add paramters to generated event handlers

Like this we would not have to search for the correct parameters for OnCollisionTrigger2D anymore for example. :)
So if its not too hard to do it would be cool to have.

Extension not working with Managed dll

I have Unity Support extension 1.3.0 installed. The extensions seem to work when editing the the main unity project within the solution. I also have a project for a managed dll which sits along side the unity project. The project for the managed dll references the unity engine dlls but doesn't appear to be using the Unity Support extension. eg when viewing the code for my MonoBehaviour in the extension dll project I still get unused method warnings.

Inspections for DrawGizmo callback parameters

Add inspections to ensure callback methods marked with the DrawGizmo attribute are defined with the correct parameters, e.g.

[DrawGizmo (GizmoType.Selected | GizmoType.Active)]
static void DrawGizmoForMyScript (MyScript scr, GizmoType gizmoType)

This must have two parameters, one object that is the target, and the second is GizmoType. The inspection should verify the type of the target object. (What is this type? MonoBehaviour? Component?)

OnGUI method marked as unused and named inconsistently

In Unity, OnGUI is a function that is called by the editor to render a user interface, either in game or (more importantly) when writing editor extensions.

Resharper marks this method has having inconsistent naming as the suggested name is OnGui, obviously this would break the functionality of the method. Resharper should recognize it as a built in Unity function and ignore the naming inconsistencies.

Resharper also marks this method as unused when leaving out the [UsedImplicitly] attribute, even though it is being called by the engine.

unity on gui

Thank you for your continued support on this extension, it has helped me tremendously!

Not Available in ReSharper 10.1

I'm on the bleeding edge of ReSharper and currently testing out ReSharper 10.1 EAP, but unfortunately, Unity for ReSharper exist in ReSharper Extensions screen and the previously installed Unity for ReSharper plugin doesn't get loaded.

Steps to Reproduce:

  1. Install ReSharper 10.1 EAP 6 into Visual Studio
  2. Open Unity project in Visual Studio
  3. Notice Unity for ReSharper isn't working
  4. Look for Unity for ReSharper in ReSharper Extension Manager

Results:
Unity for ReSharper isn't found.

Expected Results:
Unity for ReSharper is available to install.

Feature request: Add [SerializeField] attribute when using Refactor-Encapsulate field on serialized fields

When using Refactor-Encapsulate with the private field option on public serialized fields in Unity data loss can occur because private fields must be marked for serialization explicitly. Ideally an encapsulation-refactor in resharper-unity should turn this:
refactorencapsulatebefore

Into something like this:
refactorencapsulateafter
(Depending on what was selected in the refactor dialog window of course, in this case the field was set to private as well.)

Do note that since the name chosen for the property was the same as the field already had, ReSharper has also renamed the backing field to avoid a name collision, in those instances it should also mark the field with a FormerlySerializedAs attribute with the old field-name as an argument, so you would end up with is something like this:
refactorencapsulateafter2

Methods called by Invoke marked as never used

For Example:

using UnityEngine;

public class Example : MonoBehaviour
{
    private void Start()
    {
        Invoke("SomeMethod", 0f);
    }

    void SomeMethod() // <- Marked as never used
    {
        Debug.Log("Hello World");
    }
}

Rename/migrate fields

Would like an option to right-click a field on a ScriptableObject field and make migrations such as field rename, type migrations (perhaps via a user custom static method to make conversion of individual objects).

Make namepsace providers configurable

While the exclusion of "Assets\Scripts" from the namespace providers was a great addition, it would be nice if this was configurable. For example, in my case, my scripts are stored in "Assets\Scripts". It's common for folks who provide third party Unity packages to layout their project in this manner. I don't want Resharper to include "<CompanyName<ProductName>\Scripts" in my namespace. Making namespace providers configurable would solve my issue.

Can't add as an extension

Use ReSharper's Extension Manager (ReSharper → Extension Manager), search for "Unity" and install. Restart, and it'll just start working.

I don't see this option. I see an Add that takes the name and URL. Thoughts?

.

private void OnEnable & OnDisable are marked as not used

I've got solution-wide analysis turned on in addition to colour-identifiers. These methods are shaded slightly to indicate they're not used by anything, but solution-wide analysis does not have an issue with them.

I think they should not be shaded; they're definitely used by Unity.

After opening a MonotBehavior project, Resharper 10 Option menu turns dark

Hello,
I just installed the new Unity Plugin version 1.2.0 and noticed that after I opened my unity project, if I try to invoke the Resharper Options menu , the background turns pitch dark which makes it impossible to read the text and make changes. It is important to mention that this behavior does not happen if I open a different c#/.NET or c++ prjects. It seems like it only happens when I open a MonoBehavior project (a.k.a Unity).

How to reproduce:

  1. Install Reharper Ultimate version 10.0.2.
  2. Install Unity Support extension version 1.2.0
  3. Open a new MonoBehavior project , either via Unity Editor or straight from Visual Studio.
  4. Click on Resharper -> Options and then choose Intellisense -> autopopup for instance.

EDIT:
I forgot to mention that I am running on Windows 10.

here is a screenshot:

image

Support SerializedObject and SerializedProperty

E.g. Given something like

using UnityEngine;
using UnityEditor;

public class MyObject : ScriptableObject 
{
  public int myInt = 42;
}

public class SerializedProperty : MonoBehaviour 
{
  void Start () 
  {
    MyObject obj = ScriptableObject.CreateInstance<MyObject>();
    SerializedObject serializedObject = new SerializedObject(obj);

    SerializedProperty serializedPropertyMyInt = serializedObject.FindProperty("myInt");

    Debug.Log("myInt " + serializedPropertyMyInt.intValue); 
  }
}
  • Create a reference provider for the "myInt" string literal to reference the MyObject.myInt field, providing find usages + rename support
  • The reference provider would provide a candidate list of available public fields to power code completion in the string literal
  • Flow type information from the property name to the usage of the property, so that the correct accessor is used - if myInt is actually a string, then serializedPropertyMyInt.intValue will fail. It should suggest serialisedPropertyMyInt.stringValue

This is difficult, and would require control flow analysis. The FindProperty call would need to know the type of the object passed to new SerializedObject(obj). And the returned SerializedProperty would need some "type" information attached.

Support EditorWindow messages

Hey, would be nice to add EditorWindow messages to make Resharper ignore such methods as OnEnable and do not mark them as not used, just like you did for the usual MonoBehaviour.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.