Skip to content
This repository was archived by the owner on Mar 25, 2020. It is now read-only.

guitarrapc/R.Unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 

Repository files navigation

R.Unity

Get strong typed, autocompleted Unity string resources like Scenes, Tags, Layers, Shaders and Resources.

R.Unity is inspired from R.swift

Why use this?

It makes your code that uses resources:

  • Editor menu checked, no more incorrect strings that make your app crash at runtime.
  • Autocompleted, never have to guess that resource name again.

Currently you type:

var tag = GameObject.FindGameObjectWithTag("Player");
var font = new Font("Arial");
item.layer = LayerMask.NameToLayer("UI");
canvas.sortingLayerID = 1579608521;
var shader = Shader.Find("AR/TangoARRender");
SceneManager.LoadSceneAsync("Scenes/public");

With R.Unity it becomes:

var tag = GameObject.FindGameObjectWithTag(RUnity.TagNames.Player);
var font = new Font(RUnity.FontNames.Arial);
item.layer = LayerMask.NameToLayer(RUnity.Layers.Names.UI);
canvas.sortingLayerID = RUnity.SortingLayers.Ids.Baskground;
var shader = RUnity.ShaderNames.Builtin.AR_Slash_TangoARRender;
SceneManager.LoadSceneAsync(RUnity.SceneNames.Scenes_Slash_public);

Features

After installing R.Unity into your project you can use the RUnity static class to access resouces. If the static class is outated just run Tools/RUnity/Generate/All menu and RUnity will correct any missing/changed/added resources.

RUnity currently supports theses type of reousrces:

[TODO : Write example] [TODO : Navigate to example]

  • FontTarget
  • LayerTarget
  • NavMeshAreaNameTarget
  • ResourcesTarget
  • SceneNameTarget
  • ShaderTarget
  • SortingLayerTarget
  • TagTarget

Installation

[TODO : Add UnityPakcage] [TODO : AssetStore?]

Limitation

[TODO : Errorhandling when type mismatch or type-miss generated.]

License

R.Unity is created by Ikiru Yoshizaki and released under a MIT License.

About

Get strong typed, autocompleted resources like images, fonts and scenes in Unity projects

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors