- Home /
how to press 2 sprites to display other 1 sprite?
Hi, all . I have 3 sprites named A,B,C. Now I wish after press A with B together, the C will appear, how to write the script? sorry my script is poor. thank you !
This isn't a free scripting service, you should give it a try yourself and come here when you get stuck. If you don't know how to script at all, you should do some tutorials.
Hi,$$anonymous$$hada,thanks for reply.I looked some tutorials and can write some code but about this question that I don't know the logic in script.
Answer by FWCorey · Mar 24, 2013 at 12:41 PM
Set up the two buttons, A and B in your OnGUI() function simply check if both are true and if so draw "C".
// C# Example
using UnityEngine;
public class Example : MonoBehaviour
{
void OnGUI()
{
if(GUI.Button(new Rect(10, 10,100,100),"Button A") &&
GUI.Button(new Rect(10,110,100,100),"Button B") )
{
if(GUI.Button(new Rect(110,60,100,100),"Button C") )
{
// do button c stuff here
}
}
}
}
The Documentation can show you how to display a sprite on each button.
Your answer
Follow this Question
Related Questions
runtime: script variable not processed as demanded 1 Answer
Jump help! 1 Answer
How to implement Multcolumn draggable ListBox? 0 Answers
How to make a Main Menu 3 Answers
Jump. Script. 1 Answer