The code for object scrolling.
using UnityEngine;
using System.Collections;
public class ScrollNewProductsStatic : MonoBehaviour {
public static int curWeapon;
private int currentWeapon;
public Transform[] weapons;
// Use this for initialization
void Start () {
curWeapon = 0;
}
// Update is called once per frame
void Update () {
if(curWeapon == weapons.Length + 1){
curWeapon = 0;
}
if(curWeapon == -1){
curWeapon = 5;
}
changeWeapon(curWeapon);
//Debug.Log("Static :" + curWeapon);
}
public void changeWeapon(int num) {
currentWeapon = num;
for(int i = 0; i < weapons.Length; i++) {
if(i == num){
weapons*.gameObject.transform.localScale = new Vector3(2.0f,2.0f,2.0f);*
_ weapons*.gameObject.transform.localScale = new Vector3(1.0f,1.0f,1.0f);*_
* }*
* }*
* }*
}
This script is for all 3D objects to be scrolled. I can be attached to the top of the Projector object hierarchy (name of the projector). Then you need to two other scripts for two arrows to scroll the objects.
The first arrow:
using UnityEngine;
using System.Collections;
public class ScrollNewProductsLeft : MonoBehaviour {
* private int getScroll;*
* private int newScrollM;*
* // Use this for initialization*
* void Start () {*
* newScrollM = 0;*
* }*
* // Update is called once per frame*
* void Update () {*
* }*
* void OnMouseDown(){*
* ScrollNewProductsStatic.curWeapon++;*
* }*
}
The second arrow:
using UnityEngine;
using System.Collections;
public class ScrollNewProductsRight : MonoBehaviour {
* private int getScroll;*
* private int newScrollA;*
* // Use this for initialization*
* void Start () {*
* newScrollA = 0;*
* }*
* // Update is called once per frame*
* void Update () {*
* }*
* void OnMouseDown(){*
* ScrollNewProductsStatic.curWeapon–;*
* }*
}
Apply one script to the first arrow and the other to the second.
Feel free to improve the scripts because I have no time. It’s only an idea how to do that.
In this example, scrolling is just making the current object bigger, but you can use other effects.
Have a fun :)!