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

Creating custom rVars

pointcache edited this page Jan 15, 2017 · 4 revisions

To start creating your own Reactive Variables take a look at

  1. Move it somewhere outside of URSA folder.
  2. Open CustomRVars file.
  3. Duplicate this block , uncomment it , and fill in your own type
/*
[Serializable]
public class r_TYPE : rVar<TYPE>
{
    public r_TYPE() : base() {}
    public r_TYPE(TYPE initialValue): base(initialValue){}
    public static implicit operator TYPE(r_TYPE var) {  return var.Value; }
}
*/


[Serializable]
public class r_Vector6 : rVar<Vector6>
{
    public r_Vector6 () : base() {}
    public r_Vector6 (Vector6 initialValue): base(initialValue){}
    public static implicit operator Vector6(r_Vector6 var) {  return var.Value; }
}
  1. Open CustomRVarsDrawers file
  2. Uncomment this block and add your custom types on top
/*
[UnityEditor.CustomPropertyDrawer(typeof(r_TYPE1))]
[UnityEditor.CustomPropertyDrawer(typeof(r_TYPE2))]
[UnityEditor.CustomPropertyDrawer(typeof(r_TYPE3))]
public class ExtendInspectorDisplayDrawer : rVarDrawer { } 
*/

/*
[UnityEditor.CustomPropertyDrawer(typeof(r_TYPE1))]
[UnityEditor.CustomPropertyDrawer(typeof(r_TYPE2))]
*/
[UnityEditor.CustomPropertyDrawer(typeof(r_Vector6))]
public class ExtendInspectorDisplayDrawer : rVarDrawer { } 

Done.

Clone this wiki locally