Access modifier for FoveInterface gameobject lifecycle methods
In short: How can I properly inherit FoveInterface with its private Awake functions without changing its source code?
---------------------
I am using Fove + Unity for research. The way I use the UnityPlugin is to create my own rig object and class that derives from the original one (say MyFoveInterface : FoveInterface). The class has a bunch of protected methods that give me the impression that inheritance is encouraged. The only problem is that FoveInterface hides its gameobject lifecycle methods like Awake(), with the exception of OnDisable() in the latest version 3.1.0, for some reason. My solution is to change them all to protected and add something like base.Awake() in my inherited class. Is there another way to solve this without changing the source code? Or do you think it make sense to change them to protected for future releases as well?
Thank you for your support!
-
Hi Jialiang,
I'm taking a look at what the recommended solution is here and will get back to you (or Pierre who works on the plugin will), but changing the source is perfectly fine, and simply changing some methods to protected is a fairly simple small change that won't cause too much trouble if you need to upgrade versions in the future.
Best,
Jeff @FOVE
-
Hi Jialiang,
v3.1.1 is out now, which has the fields changed to protected so you no longer need to modify the source:
https://archives-fove.s3-ap-northeast-1.amazonaws.com/developer/Unity_Plugin_3.1.1.zip
Best,
Jeff
Please sign in to leave a comment.
Comments
4 comments