Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

click to hide ui image

Discussion in 'Scripting' started by hoshyargames, May 3, 2021.

  1. hoshyargames

    hoshyargames

    Joined:
    May 2, 2021
    Posts:
    24
    hi,

    i have a ui image as tip just at the beginning of the game which tells the user the way game runs.

    i need by just one time clicking this ui image hides and then user can jump with game character by mouse clicking.
    how should i do this please?
     
  2. hoshyargames

    hoshyargames

    Joined:
    May 2, 2021
    Posts:
    24
    so i need to ask my question like this:

    how is possible to click on a ui image and then it gets hidden?
     
  3. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,144
    Easy way, just make it a button that when you click, it turns itself off.
    Other way is to make a script with OnPointerDown and slap that on there to turn itself off.

    Note, if the player jumps still because of your code, then you just need to have a bool in there or disable your playercontroller while the tip is up and then enable it after.
     
    hoshyargames likes this.
  4. hoshyargames

    hoshyargames

    Joined:
    May 2, 2021
    Posts:
    24

    have you also an idea how to choose a ui button in scene a and then in scene b , a very specific prefab get instantiated?
     
  5. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,144
    You could either set a playerpref to determine what you need to instantiate, or use a static variable with a DontDestroyOnLoad script. Either of those should work. These are probably the simplest approaches, but certainly not the only ones.
     
    hoshyargames likes this.
  6. hoshyargames

    hoshyargames

    Joined:
    May 2, 2021
    Posts:
    24
    do you know any tutorial about making an unlock system for characters ?
     
  7. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,762
    Check out this awesome new site called google.

    Screen Shot 2021-05-03 at 2.05.01 PM.png