Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Error with random movement code?

Discussion in 'Getting Started' started by phantomunboxing, Mar 20, 2016.

  1. phantomunboxing

    phantomunboxing

    Joined:
    Nov 10, 2015
    Posts:
    43
  2. Freakyuno

    Freakyuno

    Joined:
    Jul 22, 2013
    Posts:
    138
    Take the ; off like 16, it's a function, you don't close the line with a ; which will probably clear up your error on 19, 22 and 25
     
    Ryiah likes this.
  3. Freakyuno

    Freakyuno

    Joined:
    Jul 22, 2013
    Posts:
    138
    Code (CSharp):
    1.  IEnumerator Move()
    2.     {
    3.         while(true)
    4.         {
    5.             yield return new WaitForSeconds(secondtillmove);
    6.             int rand = Random.Range(1,4);
    7.         }
    8.     }
     
    Ryiah likes this.
  4. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,848
    And quit using pastebin, fer cryin' out loud. This forum has a perfectly good code feature.
     
    Ryiah likes this.
  5. phantomunboxing

    phantomunboxing

    Joined:
    Nov 10, 2015
    Posts:
    43
    How do i use the insert code feature?
     
  6. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,141
    Do you see the row of icons above the part where you type a message?
     
  7. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,848
    Also, any time in this forum that you see a word or phrase in blue, like this, it is a link. When you wonder about whatever that sentence is talking about, you should click the link, as it most likely leads to more information.