Skip to content

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

License

Notifications You must be signed in to change notification settings

M0rph3v5/R.Unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published