Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Eric76's avatar
Eric76
Honored Guest
10 years ago

C++ question about the touchpad

So, I have my phone all setup and working with my Gear VR and my Unity. I have SDK and everything installed, but I'm more of an artist/animator, so I get messed up on code until I have the basics covered. I can make anything 3D and import that into my phone and view it as of right now.

My question is with coding, I want to be able to swap images on a plane, similar to a flipbook when I swipe forward of backward on the touchpad, with images named "name_01.png" and counting up incrementally.

What classes do I use with this? And the below code I was trying out to change the color on a cube, I can assign the color to any key on a keyboard and have it change to any color, but how do I do the above? Or at least how do I I integrate the touchpad with even changing color, then I can make the loop and count to change the map, potentially. I'm hoping changing texture isn't that much of a different code than changing color? Any help would be very appreciated!

using UnityEngine;
using System.Collections;

public class TempScript : MonoBehaviour {

void Update () {
if(Input.GetKeyDown(KeyCode.JoystickButton0))
{
gameObject.GetComponent<Renderer>().material.color = Color.red;
}
}
}
Replies have been turned off for this discussion