Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.46 KB

README.md

File metadata and controls

45 lines (32 loc) · 1.46 KB

R.Unity

Get strong typed, autocompleted resources like scenes, tags and layers in C# Unity projects

Why use this?

It makes your code that uses resources:

  • Compile time checked, no more incorrect strings that make your application crash at runtime
  • Autocompleted, never have to guess that scene name again

Currently you type:

string sceneName = "Level1";
LayerMask layer = LayerMask.NameToLayer("TransparentFX");
GameObject go = FindGameObjectsWithTag("Bullets"); // seriously, never use FindGameObjectsWithTag though
Animator.Play("IdleState");

With R.Unity it becomes:

string sceneName = R.Scene.Level1;
LayerMask layer = R.Layer.TransparentFXMask;
GameObject go = FindGameObjectsWithTag(R.Tag.Bullets); // seriously, never use FindGameObjectsWithTag though
Animator.Play(R.Animator.PlayerAnimator.IdleState);

How to use this?

Right now it doesn't auto compile everytime you add a new animation, scene or a tag yet. You can manually trigger R.Unity by running:

Tools > R.cs > Rebuild

openUPM

openupm

This repository has UPM support. Install it with:

npm install -g openupm-cli
openupm add com.m0rph3v5.runity

R.Swift

This is based on the idea of mac-cain13 and his work on R.Swift