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
2
Question by BHS · Mar 11, 2012 at 12:35 AM · disableenablewindzone

How do I disable a wind zone through script?

Does anyone know how to disable a wind zone through script? I have tried every enable/disable command and nothing works, unless there's a way to that I'm not aware of.

Please if anyone knows how it'd be great, since Unity doesn't allow us access the Wind Zone commands. I was just about to release a video of our new system and now I'm stuck with this problem.

Thanks

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Kleptomaniac · Mar 11, 2012 at 01:34 AM

I've never used Wind Zones before, but having just looked at the Script Reference, could you not just set the Wind Main and Turbulence to 0?

Hope this helps, Klep

Comment
Add comment · Show 3 · 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 BHS · Mar 11, 2012 at 02:28 AM 0
Share

Yes, this is the problem, I don't think there is anyway to access the Wind Zone through script. I have already checked all the docs.

avatar image Kleptomaniac · Mar 11, 2012 at 03:04 AM 0
Share

As is said here, WindZone is as of yet an inaccessible class. @Nividica provides a fairly hacky solution about a quarter of the way down the thread which renders it a public class, but obviously this isn't ideal. @Warwick Allison also provides an even less appealing solution to this problem here which uses animations to actually scale down the Wind $$anonymous$$ain and Turbulence, but again it's really one of the only ways of going about it under the current conditions. I for one would use the first solution from Nividica simply for the sake of convenience and consistency, but that's just choosing the least bad solution really.

It will be great when Unity makes classes like this public (another being most of the classes in Shuriken), because it hinders development and the functionality of games. Some of these areas of the engine are absolutely brilliant in theory, but without dynamic usability, there really isn't any point to them.

If there is a way that you can do this other than what is in those examples, it would be great if a mod could provide some input. But other than that, I'm afraid those are your only paths @BlackHorizonStudios.

Le sigh ...

avatar image BHS · Mar 11, 2012 at 06:40 AM 0
Share

That's a real let down, as we need this feature to be able to control wind for our storm system. Thanks for this, it pretty much sums it up. We'll have to take a different approach.

avatar image
0

Answer by knowpixels · Feb 25, 2015 at 02:19 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.

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

Disable SCRIPT HELP!!!! 1 Answer

Script Not staying disabled 2 Answers

Turn Off/on culling mask by script? 2 Answers

disable/enable mouselook not working? 1 Answer

Re Enable C# script on camera 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