Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
Sign in to follow this  
lucian112

Script help x5 I,know i spam

Question

I have this error: 

Assets/CircularMenu.cs(59,5): error CS1002: ; expected
Script: 

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

public class CircularMenu : MonoBehaviour
{

    public List<MenuButton> buttons = new List<MenuButton>();
    private Vector2 Mouseposition;
    private Vector2 fromVector2M = new Vector2(0.5f,1.0f);
    private Vector2 centercirlce = new Vector2(0.5f, 0.5f);
    private Vector2 toVector2M;

    public int menuItems;
    public int CurMenuItem;
    private int OldMenuItem;

    // Use this for initialization
    void Start ()
    {
        menuItems = buttons.Count;
    }
    
    // Update is called once per frame
    void Update ()
    {
        GetCurrentMenuItem();
        if (Input.GetButtonDown("Fire1"))
            ButtonAction();
    }

    public void GetCurrentMenuItem()
    {
        Mouseposition = new Vector2 (Input.mousePosition.x, Input.mousePosition.y);

        toVector2M = new Vector2(Mouseposition.x/Screen.width, Mouseposition.y/Screen.height);

        float angle = (Mathf.Atan2(fromVector2M.y = centercirlce.y, fromVector2M.x - centercirlce.x) - Mathf.Atan2(toVector2M.y = centercirlce.y, toVector2M.x - centercirlce.x)) = Mathf.Rad2Deg;

        if (angle < 0)
            angle += 360;

        CurMenuItem = (angle / (360 / menuItems));

        if(CurMenuItem != OldMenuItem)
        {
            buttons[OldMenuItem].sceneimage.color = buttons[OldMenuItem].NormalColor;
            OldMenuItem = CurMenuItem;
            buttons[CurMenuItem].sceneimage.color = buttons[OldMenuItem].HighlightedColor;
        }
    }
    public void ButtonAction()
    {
        buttons[CurMenuItem].sceneimage.color = buttons[CurMenuItem].PressedColor;
        if(CurMenuItem == 0)
            print("You have pressed the buttonn")
    }
}

[System.Serializable]
public class MenuButton
{
    public string name;
    public Image sceneimage;
    public Color NormalColor = Color.white;
    public Color HighlightedColor = Color.grey;
    public Color PressedColor = Color.gray;
}

Thanks :)

Share this post


Link to post
Share on other sites

10 answers to this question

Recommended Posts

  • 0

Bud. Can you read the error? You're missing a semicolon somewhere. I'm not telling you where. Anytime you miss type something you make a new thread

  • Like 1

Share this post


Link to post
Share on other sites

  • 0

No I can't. Unity gives you the EXACT line you're missing the semicolon. 

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

Please login or register to see this attachment. Please login or register to see this attachment.

Share this post


Link to post
Share on other sites
  • 0

Lucian. Look at your IDE LONG AND HARD. It is right in front of your face!

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

You're missing a semi colon on line 58. Honestly, read the error. The error literally tells you how to fix it. Rather than copy and pasting scripts try learning to write your own, or at least learn how to fix simple syntax errors...

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

Why do most people these days are completely unable to solve things?

Lucian, you can see that every line ends with a ";"  So where do you have to look for that missing semi colon? Yes!! At the end of the line. Very good. Now go and place a semi colon at the end of that line.

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

missing ";" in your debuging line "print('you have pressed the buttonn')"

 

you really should try to write slow and conscientious. you made a bunch of spelling mistakes aswell. thats your main problem by getting this errors

Edited by soulreafer

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

As I said boy - as I said :)

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

You should really open the Error List window in Visual Studio. :P

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...