Skip to content

Instantly share code, notes, and snippets.

@jakevsrobots
Created November 11, 2013 20:07
Show Gist options
  • Save jakevsrobots/7419464 to your computer and use it in GitHub Desktop.
Save jakevsrobots/7419464 to your computer and use it in GitHub Desktop.
Sample script to resize a cube based on Sharecart 1000 value.
using UnityEngine;
using System.Collections;
public class SizeBox : MonoBehaviour {
float targetX;
// Use this for initialization
void Start () {
targetX = ShareCartOneThousand.MapX;
}
// Update is called once per frame
void Update () {
float newX = Mathf.MoveTowards(transform.localScale.x,
targetX,
Time.deltaTime);
transform.localScale = new Vector3(newX, 1, 1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment