12345678910111213141516171819202122232425 |
- using UnityEngine;
- using System.Collections;
- public class SkyBackground : MonoBehaviour {
- //支持中文%
- // Use this for initialization
- void Start () {
- Update();
- }
-
- // Update is called once per frame
- public void Update ()
- {
- Vector3 left = Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height/2f, 0));
- Vector3 position = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width/2f, Screen.height/2f, 50f));
- transform.position = position;
- float width = Mathf.Abs(position.x-left.x);
- Vector3 scale = transform.localScale;
- scale.x = scale.y = width*2f;
- transform.localScale = scale;
- }
- }
|