Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 /
  • Help Room /
This question was closed Nov 17, 2015 at 09:15 AM by cleanlycashew for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by cleanlycashew · Nov 17, 2015 at 08:39 AM · scripting problembeginnermonobehaviour

Help! my script won't load, cant find the error?

Hello,

im a bit of a beginner in unity, everything was going fine but now my script wont load anymore, its says that there is no monobehaviour or that the name is not correct, but i can't see where the error is.

Could someone please help me out?

using UnityEngine; using System.Collections.Generic;

public class Test : MonoBehaviour {

 public GameObject cube;
 public int amount;
 public int minL, minR, maxL, maxR;
 
 
 
 // Use this for initialization
 void Start () {
     
     PlaceCubes ();
     
 }
 void PlaceCubes(){
     
     List<Vector3> occupied = new List<Vector3> ();
     
     
     while (occupied.Count <= amount) {
         int x, y, z, random1, random2;
         random1 = UnityEngine.Random.Range (0, 3);
         random2 = UnityEngine.Random.Range (0, 3);
         Debug.Log(random1);
         Debug.Log(random2);
         if (random1 == 1 && random2 == 1) {
             x = UnityEngine.Random.Range (minL, maxL);
             y = 1;
             z = UnityEngine.Random.Range (minL, maxL);
             
         }
         
         if (random1 == 1 && random2 == 2) {
             x = UnityEngine.Random.Range (minL, maxL);
             y = 1;
             z = UnityEngine.Random.Range (minR, maxR);
             
         }
         if (random1 == 2 && random2 == 1) {
             x = UnityEngine.Random.Range (minR, maxR);
             y = 1;
             z = UnityEngine.Random.Range (minL, maxL);
             
         }
         if (random1 == 2 && random2 == 2) {
             x = UnityEngine.Random.Range (minR, maxR);
             y = 1;
             z = UnityEngine.Random.Range (minR, maxR);
             
         }
         
         Vector3 Location = new Vector3 (x, y, z);
         
         
         
         if (!occupied.Contains (Location)) {
             occupied.Add (Location);
             Debug.Log(occupied.Count);
         }
     }
     for (int i = 0; i < amount; i++) {
         Vector3 V = (Vector3)occupied[i];
         
         Instantiate (cube, V, Quaternion.identity);
     }
     
     
 }
 
 
 bool equals(Vector3 thiy, Vector3 that)
 {
     
     return thiy.x == that.x && thiy.z == that.z;
     
 }
 

}

P.s. its probably full of stupid errors, but it did work when it was just placing 30 random cubes for me, things went wrong after i implemented the while loop.

many thanks!

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 cleanlycashew · Nov 17, 2015 at 08:49 AM 0
Share

Just found out that all my other scripts in the project wont load anymore, even the ones in other scene's which i didn't even touch. How can this be?

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

36 People are following this question.

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

Related Questions

Multiple in game currencies 1 Answer

Using LookAt to look at a Vector3 not Transform 0 Answers

there MonoBehaviour script data type? 1 Answer

How to make a shooting bow? 0 Answers

The roll a ball script isn't working 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges