- Home /
Texture as a simple button
You wouldn't believe the issues i had with it, and neither would I. I basically just wan't to create a simple button, but instead of using the default unity guiskin i just want a start button texture, to make a function when clicked. If possible i'd like to avoid all this guiskin crap because i tried it and for some reason it didn't even work. So i just need the simplest best method of just making a freaking texture that activates a function. I also want to note that it should be able to work on mobile.
Answer by robertbu · Mar 22, 2014 at 04:10 PM
Game Object > Create Other > GUI Texture
Drag and drop your texture on the 'Texture' variable
Adjust your pixel inset values for the size of your texture
Adjust the Transform position for the position of your texture.
As for function:
function OnMouseDown() {
Debug.Log("I'm clicked");
}
do i have to make a variable to put the gui texture in or do i just attach this function to the guitexture
Your answer
Follow this Question
Related Questions
Transfer controls from keyboard buttons to IPhone buttons 1 Answer
Really simple IPhone and screen question 0 Answers
DrawTexture GUI iPhone 1 Answer
Storing level data 3 Answers
simple texture question 1 Answer