Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

HELP ASAP

Discussion in 'Scripting' started by mikebatuigas, Mar 11, 2019.

  1. mikebatuigas

    mikebatuigas

    Joined:
    Mar 11, 2019
    Posts:
    1
    Hi.

    I am very new to unity, building a sliding project.
    A powerpoint like game on android, basically, I have 2D scenes with animations set up. I have images that are acting as different pages of the comic. Currently, I used canvas and buttons and scripts to switch scenes as I tap on the main page, which takes me to detailed view of each 2D scene.

    I am trying to make a method of navigation by swiping which shows and hides the image. I have no clue what I am coding, I spent 7 hours so far trying to understand other people's code that does something similar. If anyone can give me some hints or codes that would be great.


    Goal: Swipe left = hides current image and shows previous image
    swipe right = hides current image shows next image

    I also seem to have no idea of where to attach the script, do I attach it to the canvas?

    here is my code for the button which shows and hide images :

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;
    using UnityEngine.EventSystems;

    public class SwitchScene : MonoBehaviour {
    public GameObject[] ToShowScene;
    public GameObject[] ToHideScene;

    public void Instatiate(){
    for(int i = 0 ; i < ToShowScene.Length;i++){
    ToShowScene.SetActive(true);
    }

    for(int i = 0 ; i < ToHideScene.Length;i++){
    ToHideScene.SetActive(false);
    Debug.Log("yahoo");
    }

    }
    }


    Many thanks.
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,294
    You're not going to get any help by creating a thread with the title "help asap" in all caps. Try again.
     
    xVergilx and Joe-Censored like this.