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
0
Question by Machinimanetau · May 12, 2014 at 04:33 PM · runtimeweatherwindzone

Change WindZone settings in runtime?

I'm trying to make a script that changes my WindZone settings in runtime but it looks like Unity has the WindZone as private class. Is there any way to change those settings in runtime? I saw some projects doing that, any suggestions?

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 robertbu · May 12, 2014 at 04:43 PM 0
Share

Ugly but possible:

http://forum.unity3d.com/threads/60593-Access-Terrain-Wind-Setting-and-Wind-Zone-in-Unity3D-3-0-02f

For many of the settings, you can emulate the effect by just rotating the transform of the WindZone game object.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by knowpixels · Feb 25, 2015 at 02:16 PM

The WindZone DataType is private in Unity as of 3.x - this is still true as of 4.5.x This means you cannot access its properties using strict typing (#pragma strict) and typeof(). So if you try GetComponent(WindZone) or GetComponent(typeof(WindZone)) you will receive an unknown type error message from Unity Console. All you have to do is switch to dynamic typing, it is this easy:

  1. Remove #pragma strict from the top of your script.

  2. Change any usage instance of GetComponent(WindZone) or GetComponent(typeof(WindZone)) to GetComponent("WindZone"); (Include speech marks!) and remove any var type declartions.

So instead of:

 #pragma strict
 var wz:WindZone = GetComponent(WindZone);

Your script should look like:

 //#pragma strict
 var wz = GetComponent("WindZone");

Now the unknown type error in Unity console will be gone and your script has access to WindZone script properties through the var called "wz" you can now do:

 wz.windMain = 1;
 wz.windTurbulence = 1.2;
 wz.windPulseMagnitude= 0.6;
 wz.windPulseFrequency= 0.2;


Or what ever you need for runtime visibility and control of in game blustery goodness. I hope someone finds this comment useful.

Comment
Add comment · Show 1 · 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 ActionScripter · Dec 23, 2015 at 06:35 PM 0
Share

This helped me out. Thanks for the comment.

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

22 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

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

how to change parenting or look at or any other property at runtime? 0 Answers

Runtime javascript 1 Answer

object facing wrong way, Java script Quaternion 1 Answer

Why is GetComponent() causing a null exception 2 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