๐Ÿ“œ [Script] Tap / Touch Change Only Image Script *Important

Options

Script:- Change Image on Tap

Ready to use Script

// Change Image On Tap
// @input Component.Image background
// @input Asset.Texture[] images

var index = 0;
script.background.mainPass.baseTex = script.images[index];

script.createEvent("TapEvent").bind(function () {
  index += 1;
  if (index >= script.images.length) {
    index = 0;
  }
  script.background.mainPass.baseTex = script.images[index];
  print("Tap");
});

Steps to use:-

  • Create Scene Object
  • Add Script Component
  • Create Script In Resource Panel & Rename it as TouchImageScript
  • Add TouchImageScript to Scene Object Script
  • Copy Paste this Script & Save
  • Add Single Image Component to the Script in Background
  • Add Series of Images to the Script

Use:-

  • Change multiple Images on touch.
  • Change Multiple Image on Screen Text Object.
  • No need to Create Multiple Image Component.