OSVR / OSVR-Unity

Package for authoring OSVR experiences with Unity.
Apache License 2.0
98 stars 38 forks source link

Fix: Create an interface from script #158

Closed demonixis closed 8 years ago

demonixis commented 8 years ago
DuFF14 commented 8 years ago

Sorry for leaving this hanging. Looks OK to me and doesn't break anything. Can you provide a simple test case for how you discovered there was an issue? Were you working on input?

demonixis commented 8 years ago

Hi,

The first thing is you can't use a constructor in a MonoBehaviour because Unity doesn't allow/recommand it.

Finally, I've created an InputManager for OSVR and I create some InterfaceGameObjectBase at runtime. The InterfaceGameObjectBase script requires the path of the interface but the AdvertisePath() method is called in the Awake method. So if I create a script at runtime, I don't have the time to pass the path and this method is called, resulting to a crash.

That's all ;-)

DuFF14 commented 8 years ago

Yea, I haven't seen a monobehaviour constructor before. Will merge this in soon with the other updates. Thanks.

demonixis commented 8 years ago

More informations here (for Unity 5.4 release)