Hi, I am doing a university project on 3D geovisualisation and I don’t have any experience in unity. I was wondering if I would be able to show a layer of the environment after pressing a button and even change the height of the character.
Buttons are just signals that tell something in your game “go now”.
If you can make something happen at all, you can make it happen when a button is pressed. On the other hand, if you don’t know how to make something happen, “use buttons” is not going to solve that for you (unless the problem is “I need to know when the user wants me to do this”).
The examples you mention are probably pretty easy to do, though. (Depending on how you’ve chosen to represent them in your game and if you need any extra bells-and-whistles like animations.)
Simplest way to make objects appear/disappear is usually by calling SetActive().
Height of something can probably be adjusted by changing its transform’s “scale” property, and possibly in other ways depending on the context.
The other layers are 3D objects (at least that what they say in file explorer), I’m trying to have them pop up or fade into the environement after i press said button although my experience with unity is extremely limited. As for the character it is set as an FPSController (if that means anything to you). I was hoping to be able to change the scale while playing.
You could do what you want in so many ways. You could have the button run code on a component, run an animation to fade something in and out/change the scale, change the camera culling mask, enable/disable game objects, and so on.
You could even do it all without any code and simply assign the OnButtonClicked Event in the inspector to set the active state of objects or enable animations.
Select the button, find the “OnClicked” property, click the plus button to add an entry, drag in the object you want to show or hide, from the dropdown select GameObject → SetActive, and then toggle the checkbox depending on whether you want it to become active or inactive.
If you want a single button that switches back and forth, you can use a Toggle instead of a Button, and when you choose “SetActive” make sure it is under the “dynamic bool” subheading. Alternately, you can have two buttons in the same place, and make it so that clicking one button makes that button inactive and the other button active. (You can make a button do multiple things when clicked, just keep adding more entries to the “OnClicked” list.)
I made a toggle over my image and selected what you instructed, when I play the game is it supposed to work with a click or a button because nothing changes after i walk upto and attempt to interact with the button.
I was thinking GUI (specifically, Unity-UI on a Canvas). If you want something the player object can interact with through the game world, then I couldn’t tell you how to do that off the top of my head.