Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
1
Question by UnityGuy1243 · Nov 13, 2011 at 06:52 PM · noiseperlin

Why Doesn't This Work?

I recently downloaded the procedural unity example project and came across something that I can't figure out. In one of their script theirs these lines:

 private var perlin : Perlin;
 private var fractal : FractalNoise;

I made them public but nothing showed up in the inspector. If you can't assign something to it then whats the point of having it? What do these lines mean because I though you could only make variables ints, floats, booleans, ect... Then I put these lines of code in a new script and I got the error: The name 'Perlin' does not denote a valid type ('not found'). Did you mean 'TreeEditor.Perlin'? and The name 'FractalNoise' does not denote a valid type ('not found'). Did you mean 'TreeEditor.FractalNoise'?

Here is the whole script from the example project in case you need more info.

 // This script is placed in public domain. The author takes no responsibility for any possible harm.
 
 var gray = true;
 var width = 128;
 var height = 128;
 
 var lacunarity = 6.18;
 var h = 0.69;
 var octaves = 8.379;
 var offset = 0.75;
 var scale = 0.09;
 
 var offsetPos = 0.0;
 
 private var texture : Texture2D;
 private var perlin : Perlin;
 private var fractal : FractalNoise;
 
 function Start ()
 {
     texture = new Texture2D(width, height, TextureFormat.RGB24, false);
     renderer.material.mainTexture = texture;
 }
 
 function Update()
 {
     Calculate();
 }
 
 function Calculate()
 {
     if (perlin == null)
         perlin = new Perlin();
     fractal = new FractalNoise(h, lacunarity, octaves, perlin);
     
     for (var y = 0;y<height;y++)
     {
         for (var x = 0;x<width;x++)
         {
             if (gray)
             {
                 var value = fractal.HybridMultifractal(x*scale + Time.time, y * scale + Time.time, offset);
                 texture.SetPixel(x, y, Color (value, value, value, value));
             }
             else
             {
                 offsetPos = Time.time;
                 var valuex = fractal.HybridMultifractal(x*scale + offsetPos * 0.6, y*scale + offsetPos * 0.6, offset);
                 var valuey = fractal.HybridMultifractal(x*scale + 161.7 + offsetPos * 0.2, y*scale + 161.7 + offsetPos * 0.3, offset);
                 var valuez = fractal.HybridMultifractal(x*scale + 591.1 + offsetPos, y*scale + 591.1 + offsetPos * 0.1, offset);
                 texture.SetPixel(x, y, Color (valuex, valuey, valuez, 1));
             }
         }    
     }
     
     texture.Apply();
 }


Also that script contains the line:

 var valuex = fractal.HybridMultifractal(...);

If you search for this function you get nothing. This really stumps me because you can't just make up functions! It cant be a .Net method because nothing is being imported.

Please help me under stand why there are made up functions and variables of type "Perlin" and "FractalNoise".

Comment
Add comment · Show 2
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 syclamoth · Nov 13, 2011 at 11:53 PM 0
Share

Perlin and FractalNoise refer to classes you obviously haven't written! You can't assign them in the inspector, because they are neither objects in your scene, nor serializable attributes. Also, the point of a public variable isn't that you can view it in the inspector- it's that you can modifiy it from other scripts. Viewing it in the inspector is a subset of that functionality, that only works on certain types.

avatar image Saitodepaula · Aug 10, 2012 at 02:14 PM 0
Share

Hi, take a look at this question: http://answers.unity3d.com/questions/298703/perlin-noise-continuous-through-different-objects.html. I've used the same Perlin noise function from the Procedural examples.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by WillTAtl · Nov 13, 2011 at 10:49 PM

Perlin and FractalNoise are custom classes defined by other scripts in the sample project (which most likely have the same names). If you've been groping along through unity scripting without knowing this much, I strongly recommend you review some basic tutorials on the subject. The javascript series from Walker Boys Studio would probably be a good place to start. Parts 22-25 goes over defining custom classes (which can be used as variable types, like Perlin) and class functions (like the HybridMultifractal function which is defined in the FractalNoise class)

Comment
Add comment · 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
0

Answer by lastprogrammer · Nov 28, 2013 at 06:18 PM

I'm having the same problem. I can't find those classes anywhere in the project. They just seem to come out of nowhere. Even when I use 'Go To Declaration' inside of Monodevelop, nothing comes up. It's like their ghost classes.

Comment
Add comment · 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
0

Answer by Spondee · Jan 15, 2014 at 06:58 PM

The functions (HybridMultifractal and Perlin) and are located in the Perlin.cs script. You have to make sure to import this script as well, it is in the Plugins folder.

Comment
Add comment · 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

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.

Follow this Question

Answers Answers and Comments

7 People are following this question.

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

Related Questions

What's wrong with this code? Perlin Noise 0 Answers

Perlin noise tutorials ? 2 Answers

Perlin Noise Issue 0 Answers

Basics of Perlin Noise? 1 Answer

Perlin Noise Plane Manipulation 1 Answer


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