• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by anloko123 · Jan 03, 2016 at 09:02 AM · javacs

Operator `&&' cannot be applied to operands of type `int' and `UnityEngine.UI.Button.ButtonClickedEvent'

  using UnityEngine;
  using UnityEngine.UI;    
  using System.Collections;

 public class Buttons : MonoBehaviour {
 public Button Przycisk;
 public Button Przycisk2;
 int MPrzycisk;
 int MPrzycisk2;
 private MapSelected mapSelected;
 public void StartButton()
 {
     
 }


 public void QuitButton()
 {
     Application.Quit ();
 }
 public void Mapa1()
 {
     mapSelected = GetComponent<MapSelected>();
     mapSelected.Scena = 1;
 }
 public void Mapa2()
 {
     mapSelected = GetComponent<MapSelected>();
     mapSelected.Scena = 2;
     
 }




 // Use this for initialization
 void Start () {
 
 }
 
 // Update is called once per frame
 void Update () {


     mapSelected = GetComponent<MapSelected>();
  if (mapSelected.WScena == 1 & Przycisk.onClick)
     {
         Application.LoadLevel(1);
     }
 if ((mapSelected.WScena == 2) & (Przycisk2.onClick))
     {
         Application.LoadLevel(2);
     }
  }
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ShadyProductions · Jan 03, 2016 at 03:31 PM 0
Share

anything else?

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by ShadyProductions · Jan 03, 2016 at 02:47 PM

A button works as follows:

         void OnGUI() {
             if (GUI.Button (new Rect (Screen.width / 2 - 100, Screen.height / 2 + 10, 150, 20), "BUTTONTEXT")) {
                     //change the values to change size and position
                 if (mapSelected.WScena == 1) {
                     //do something
                 } else if (mapSelected.WScena == 2) {
                     //do something
                 }
             }
         }
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image AlanGreyjoy · Jan 03, 2016 at 02:55 PM 0
Share

onGUI... ahhh my eyeeessss $$anonymous$$Y EEEYYYEEESSS... THHEEEEEYYY BUUUUURRRNNNN!!!!! :P

avatar image ShadyProductions AlanGreyjoy · Jan 03, 2016 at 02:57 PM 0
Share

shhtt, i'm still sleeping :D

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can I access Java code from Unity? 2 Answers

How to remove an add? 0 Answers

Touch menu for android 1 Answer

Unity Android action bar callbacks? 1 Answer

Why isn't my java code working? 2 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges