Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class MoveThings : MonoBehaviour {
- private Renderer rn;
- // Use this for initialization
- void Start () {
- rn = GetComponent<Renderer>();
- }
- // Update is called once per frame
- void Update () {
- var cb = Camera.main.GetOrthographicBounds();
- var bb = rn.bounds;
- if (cb.min.x > (transform.position.x + bb.size.x / 2))
- transform.position = new Vector2(cb.max.x + bb.size.x / 2, transform.position.y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement