Beispiel #1
0
            /// <summary>
            /// Call from your Start method
            /// </summary>
            protected void Start()
            {
                if (null != iface)
                {
                    return;
                }
                AdvertisePath();
                GameObject go       = this.gameObject;
                PathHolder holder   = null;
                string     usedPath = path;

                while (null != go && 0 == usedPath.Length)
                {
                    holder = go.GetComponent <PathHolder>();
                    if (null != holder)
                    {
                        usedPath = holder.path;
                        //print("[OSVR] " + name + ": Found path " + usedPath + " in ancestor " + go.name);
                    }
                    go = GetParent.Get(go);
                }

                if (0 == usedPath.Length)
                {
                    Debug.LogError("[OSVR] Missing path for " + name + " - no path found in this object's InterfaceGameObject or any ancestor!");
                    return;
                }

                iface      = ScriptableObject.CreateInstance <InterfaceCallbacks>();
                iface.path = usedPath;
                iface.Start();
            }
            // Use this for initialization
            void Start()
            {
                _camera = gameObject.GetComponent <Camera>();
                if (_camera == null)
                {
                    Debug.LogError("[PVR-Unity] PVRSurface need Camera component.");
                    return;
                }

                _eyeOffset = gameObject.GetComponent <PVREyeOffset>();
                if (_eyeOffset == null)
                {
                    Debug.LogError("[PVR-Unity] PVRSurface need PVREyeOffset script component.");
                    return;
                }
                GameObject parent = GetParent.Get(this.gameObject);

                if (parent)
                {
                    _tracking   = parent.GetComponent <PVRPoseTracking>();
                    _headlocked = (_tracking == null || (!_tracking.enabled));
                    _layerId    = parent.GetInstanceID();
                    Camera parentCamera = parent.GetComponent <Camera>();
                    if (parentCamera)
                    {
                        _camera.CopyFrom(parentCamera);
                    }
                }

                EnsureRenderTarget();
            }
Beispiel #3
0
        /// <summary>
        /// Call from your Start method
        /// </summary>
        protected virtual void Start()
        {
            AdvertisePath();
            GameObject go     = this.gameObject;
            PathHolder holder = null;

            while (null != go && System.String.IsNullOrEmpty(usedPath))
            {
                usedPath = path;
                holder   = go.GetComponent <PathHolder>();
                if (null != holder)
                {
                    usedPath = holder.path;
                    //Debug.Log("[OSVR-Unity] " + name + ": Found path " + usedPath + " in ancestor " + go.name);
                }
                go = GetParent.Get(go);
            }

            if (0 == usedPath.Length)
            {
                Debug.LogError("[OSVR-Unity] Missing path for " + name + " - no path found in this object's InterfaceGameObject or any ancestor!");
                return;
            }
        }