Skip to content

pjc0247/Rinity2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rinity2

SuperPower Unity!

Rinity2 performs IL(C# bytecode) modification to accomplish syntax magics which cannot be done in vanilla C#/Unity.
This may sensative to Unity version changes and not work with latest Unity.

Requirements

  • Unity 2017.3 or higher

Features

Overview

Recycle

[Recycle]
public class Player {
    /* ... */
}

/* auto pooling */
var player = new Player();

Automatically recycles the objects instead of creating new one.
based on this small research

String Interpolation

int a = 1234;

Debug.Log("a is {{a}}.")
  • This feature is no longer useful since Unity fully supports latest .Net and C#.

Dispatch

[Dispatch(ThreadType.ThreadPool)]
public void DownloadJson(string uri) {
    // This will be executed in background thread.
    var json = SomeDownloadMethod(uri);

    OnDownloadJson(json);
}

[Dispatch(ThreadType.MainThread)]
public void OnDownloadJson(string json) {
    // Will be executed in main thread.

    /* do UI tasks */
}

Just call methods without threading concerns, it automatically dispatches to right thread for you.

SharedVar

[SharedVariable("shared_level")]
public int level {get;set;}

[SharedVariable("shared_level")]
public int level2 {get;set;}

Trace

[Trace]
public void WorkWork() {
    /* .... */
}

NotifyChange

class Player : INotifyPropertyChanged {
    public event PropertyChangedEventHandler PropertyChanged;
    public int level { get; set; }

    void Start () {
        PropertyChanged += OnPropertyChanged;
    }

    // Automatically called when property is changed.
    private void OnPropertyChanged(object sender, PropertyChangedEventArgs e) {
        Debug.Log("PROPERTY CHANGED : " + e.PropertyName);
    }
}

DbgHelper

// Same as __LINE__ in C++
Debug.Log( DbgHelper.CurrentLine );

About

super power unity 2

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages