-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InterfaceAdapter implementation for Unity #57
Conversation
…sses now use them. Added ButtonInterface and AnalogInterface, and Requires{interfaceType} classes.
…e endings in some files.
…justed RequiresAnalogInterface and the others to implement a common interface, and streamlined the API to make the IInterface<T> instance easier to access from subclasses. Updated samples to not use the obsolete classes.
Good work, this seems to fix the scene switching bug :) You also might want to add prefabs for button and analog objects to OSVRUnity/Prefabs. |
…omponent prior to being Started by Unity. Now the getter for the IInterface properties ensure Start is called, as was done in InterfaceGameObject. Added null guards to RequireAnalogInterface and others. InterfaceGameObjectBase.Start is now idempotent, as are all the subclasses. Modified VRDisplayUntracked prefab to add a DisplayInterface and an osvr distortion component. Created new prefabs for analog and button interfaces. Modified minigame.unity and devscene.unity to use new interface types in place of InterfaceGameObjects.
I was able to reproduce your null reference exceptions by testing in the unity editor as opposed to just the standalone mode. They had two causes: one - minigame.unity had the wrong interface type attached to the button and analog game objects (InterfaceGameObject instead of ButtonInterface and AnalogInterface, respectively), and two I wasn't ensuring Start was called from the IInterface property getters for each interface type, as was done in InterfaceGameObject. Turns out Unity doesn't ensure Start is called prior to returning an object with GetComponent, which I wasn't expecting. I made the requested modifications to VRDisplayUntracked prefab and added the button and analog prefabs as suggested. I wasn't able to reproduce any other errors in these scenes. Could you describe the steps to reproduce them? I can take a second look if need be. I've tested all the scenes (devscene, minigame, TrackerView, VRDisplayDemo, UntrackedVRDisplayDemo, OSVRDemo, and OSVRDemo2 - let me know if I missed one) in both the editor and in standalone mode with the changes in |
@DuFF14 so should we be merging this? or do you need to add to it first? |
minigame and devscene are causing Unity to crash for me, using 4.6.5 and 4.6.1. Works for me with Unity 5.0.3f2 64bit and similar 32 bit. Here is the editor log Other than the metadata thing in Unity 4, this looks good. After this is merged, I will update the persistent singleton branch. |
Another editor log that looks different. Looked up the "CheckConsistency: Restored Transform child parent pointer from NULL" message and found this thread about it: http://forum.unity3d.com/threads/objects-loose-info-after-import.34344/ Looks like a weird bug related to... modifying prefabs? (sorry, I asked for this) There are a couple of solutions to try here. I tried opening the scene in Unity 5, breaking prefab instances related to the prefabs we just modified, re-saving the scene and trying to open in Unity 4, but still get a crash. edit: copying the scenes and deleting the old versions did not work. Reverting to previous commit does work. Not sure what could cause this. Perhaps the scene was saved in Unity 5, and the scene file has some properties in it that Unity 4 doesn't know what to do with? |
Yep, that is likely it. I was editing the scenes in unity 5. I will redo the scene changes in unity 4 tonight. |
I have confirmed that the issue was unity 5 scene/prefab incompatibility. I re-implemented the scene and prefab changes in unity 4 from the prior versions, and re-tested all scenes in that version. That fixed the console errors. I'm using unity 4.6.7. Edit: I also confirmed that my editor settings are set as @DuFF14 described. |
I thought I'd be able to add commits here, but it appears I have to open a new pull request without push access to the forked repo. There were still some errors for me in devscene.unity, but I fixed them along with some other minor changes in the demo scenes: #58 |
Oh rats, forgot to have you write an entry in the changes file for anyone upgrading: what will they have to change in their existing code? Can someone do this? |
I put that change in a separate pull request: #60 |
Implements #53
Also obsoletes InterfaceCallbacks and InterfaceBase classes.