static void InjectGameObjectReferences() { MultipleObjectClassifier += (attr, field, monoHolder) => { if (attr.ComponentAddress != GetComponentFrom.TargetGameObject) { return; } GameObject targetObj = GameObject.Find(attr.TargetName); field.SetValue(monoHolder.t, targetObj.GetComponent(field.GetValue(monoHolder.t).GetType())); }; Inject(); }
static void InjectScriptReferences() { SingleObjectClassifier += (attr, field, obj) => { switch (attr.ComponentAddress) { case GetComponentFrom.Self: field.SetValue(obj, obj.GetComponent(field.FieldType)); break; case GetComponentFrom.SceneObject: field.SetValue(obj, MonoBehaviour.FindObjectOfType(field.FieldType)); break; } }; Inject(); }