mardi 14 avril 2015

Finding an instance of a private class in a separate assembly

In my Unity project, I am utilizing a networking library which, understandably, also keeps track of inbound/outbound traffic. However for some reason, the developer decided to leave this info only available in the editor, instead of making it publicly accessible at runtime. But, I would like to do some traffic benchmarking, and change my code flow at runtime depending on traffic.


Using reflection, I could easily get an instance to the internal class (and private field) which keeps track of networked traffic, but this does not resolve anything because it won't be the same instance that the actual separate assembly utilizes, so the value will always be zero.


So... Is there any way to find a valid instance of a known class inside an assembly which my project references?






Aucun commentaire:

Enregistrer un commentaire