Code Monkey home page Code Monkey logo

unityrefanalyzer's Introduction

UnityRefAnalizer

Build status NuGet

Roslyn code analyzer to find method usages on scenes. Early stage of production, issues represents progress.

You can see which methods is referenced from scenes: screen_1

And even find objects where it referenced: screen_2

Summary

This project get you ability to track scene references to your methods inside your IDE. It's useful, because IDE don't now anything about such links and you can't rely only on "Find References" feature. Example: you think that method in your class isn't used and decided to remove it. But you identify issues with that only when open one of your scene, when it actually used and inspect references. Such problems is hard to predict in common cases.

UnityRefAnalyzer contains two parts:

  • Unity-side exporter - made .json report about suck links from your assets
  • Roslyn analyzer - analyze report & your sources

Features

  • Shows warnings on methods, which referenced via Inspector (in IDE)
  • Show warnings on missing references in Unity log when exporting data

Requirements

  • Unity 2017.3+
  • Scripting backend: experimental (.NET 4.6+)

Installation

NuGet

Visual Studio

  • Project/Manage NuGet Packages, find UnityRefAnalyzer, install it
  • or Tools/NuGet Package Manager/Package Manager Console, 'Install-Package UnityRefAnalyzer'

Rider

  • Switch to Solution mode in explorer panel
  • Project/Manage NuGet Packages, find UnityRefAnalyzer, install it

Manual

  • Open RefAnalyzer/RefAnalyzer.sln, build it
  • Open you Unity project

Visual Studio

  • References/AddAnalyzer - select RefAnalyzer/RefAnalyzer/Newtonsoft.Json.dll
  • References/AddAnalyzer - select RefAnalyzer/RefAnalyzer/bin/Debug/netstandard1.3/RefAnalyzer.dll

Rider

  • Add references to csproj file manually: <ItemGroup><Analyzer Include=".../Newtonsoft.Json.dll"/><Analyzer Include=".../RefAnalyzer.dll"/></ItemGroup>

Export

To get analyzer to work, you need to collect data from assets in your Unity project.

  • Import package.unitypackage
  • Open Exporter window - Window/RefAnalyzer
  • Click RefreshData
  • When it's done, you get refs.json file in root of your project
  • It represents all inspector-based links in you assets
  • When you build project in IDE (and if analyzer is installed properly), you get warnings in methods definitions, which is used on scenes
  • If links on your scenes changed, you need to refresh it manually

Debugging

Common

  • If you are changed RefAnalyzer.Shared code, you need to run RefAnalyzer/RefAnalyzer.Shared/copy_dlls_to_unity_project.sh to get this changes on Unity side
  • Or you can copy DLL's manually
  • Use RefAnalizer/Export Package to update package.unitypackage after changes in exporter

Visual Studio

  • Open RefAnalyzer/RefAnalyzer.sln, run it
  • Another Visual Studio instance will appear, when you open any other project, analyzer will be added automatically

Rider

  • Add references to other project manually
  • Changes will be applied when you rebuid other project

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.