OVRProgressIndicator.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /************************************************************************************
  2. Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
  3. Licensed under the Oculus Utilities SDK License Version 1.31 (the "License"); you may not use
  4. the Utilities SDK except in compliance with the License, which is provided at the time of installation
  5. or download, or which otherwise accompanies this software in either electronic or hard copy form.
  6. You may obtain a copy of the License at
  7. https://developer.oculus.com/licenses/utilities-1.31
  8. Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
  9. under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  10. ANY KIND, either express or implied. See the License for the specific language governing
  11. permissions and limitations under the License.
  12. ************************************************************************************/
  13. using UnityEngine;
  14. using UnityEngine.UI;
  15. using System.Collections;
  16. /// <summary>
  17. /// Visualizes progress for operations such as loading.
  18. /// </summary>
  19. public class OVRProgressIndicator : MonoBehaviour
  20. {
  21. public MeshRenderer progressImage;
  22. [Range(0, 1)]
  23. public float currentProgress = 0.7f;
  24. void Awake()
  25. {
  26. progressImage.sortingOrder = 150;
  27. }
  28. // Update is called once per frame
  29. void Update()
  30. {
  31. progressImage.sharedMaterial.SetFloat("_AlphaCutoff", 1-currentProgress);
  32. }
  33. }