Search Unity

Question Getting UI to pop up when holding an object

Discussion in 'VR' started by kleinmanm13, Feb 9, 2023.

  1. kleinmanm13

    kleinmanm13

    Joined:
    Nov 13, 2022
    Posts:
    1
    Hello Unity community,

    I am working on a project where I need information to come into the users vision when grabbing an object. I've been looking all around for information on how to do this and the closest I've found is someone asking the same question as I with the only reply being "look at tutorials".

    If anyone knows how to do this or knows about a tutorial, please send it my way.

    Thanks in Advance!
     
  2. nilagard

    nilagard

    Joined:
    Jan 13, 2017
    Posts:
    77
    Tutorials are quick and easy fixes, but you'll never learn anything from them if that's your goto to fix your problems. Trust me, I've been in your shoes for years of doing the same mistake over and over again. Sit yourself down, grab a pen and paper and come up with some form of logic on how to solve this issue, the code will come later. After you've come up with an algorithm of how you want to tackle this first then you can start googling for code and searching Unity documentation.

    I would start this process by saying that you have your controller which wants to grab an object, right? How do you plan on letting yourself know when the object is grabbed? Do you want the hand to tell you or do you want the object to tell you? How do you want to set this up. Is the object to be picked up by others or just you? Do you need some form of indicator to tell you what player picked it up or do you just need a basic text to tell you that it's picked up? Start simple! You are trying to eat the whole cake in 1 bite, it's not gonna work if you don't simplify your approach.

    Research how Unitys UI works, play with that a bit. Make some windows, make some texts pop up in different UI windows when clicking an object, attach menus and windows that enables when something triggers it to different objects (which is very close to what you want to do here). Experiment makes excellent practice and it will help you and your coding/logic skills greatly down the line. If you keep looking for simple solutions when your coding knowledge is where it is then you'll crash and burn every time something gets mildly complex.