Forum Discussion
naam00
12 years agoHonored Guest
Attach To Camera help
Hey Guys, Since the forum doesn't allow me to search for the string AttachGameObjectToCamera (I guess it's too long?), I suspect this may have been answered elsewhere, but other queries lead to not...
drash
12 years agoHeroic Explorer
A property or indexer `UnityEngine.Component.gameObject' may not be passed as `ref' or `out' parameter
Aha! "gameObject" is a property of the MonoBehaviour you're in, not a variable. Properties have get/set accessors that can potentially do more than just retrieve and assign the value to a variable, so it makes sense that they can't be passed in by ref that way.
You can probably just do it like standtall007 suggested, or if you're trying to attach the GameObject you're in:
GameObject thisGameObject = this.gameObject;
ovrCam.AttachGameObjectToCamera( ref thisGameObject );
Note that if you're trying to attach a different gameObject that you've created other than the one you're in, try using a different name for it because "gameObject" is already taken (the property on the MonoBehaviour).
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 8 months ago
- 7 months ago
- 3 years ago