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 Johan 4 · Apr 19, 2011 at 09:49 PM · materialrenderersetfloat

SetFloat doesn't work

I do a renderer.material.SetFloat("_Fresnel", 1);

but it doesn't work

What's strange is that if I do GetFloat, it returns the right value

The shader was made in Strumpy's Shader editor. I myself know nothing about shader language The code is: http://pastebin.com/q0kYRN9i

I used pastebin because this answers doesn't seem to have proper quotes.

Comment
Add comment · Show 5
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 Marnix · Apr 19, 2011 at 09:54 PM 0
Share

@Johan: What doesn't work? You don't get results? $$anonymous$$aybe your shader code is wrong. Give us some more code, like the part of your shader that is using it.

avatar image DaveA · Apr 19, 2011 at 09:56 PM 1
Share

try 1.0 or 1f ins$$anonymous$$d

avatar image Johan 4 · Apr 19, 2011 at 10:04 PM 0
Share

Ok edited with code

avatar image Eric5h5 · Apr 19, 2011 at 10:38 PM 0
Share

@DaveA: that makes no difference; ints are cast to floats as needed.

avatar image God-at-play · Jun 25, 2014 at 02:20 AM 0
Share

I'm having the same problem. I can print the value just fine using GetFloat(), and edit my field in the inspector, and the new value even prints. But the value that's being used in my vertex function seems to be 0.

Anyone find a solution yet?

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by efge · Apr 19, 2011 at 10:16 PM

The name of the property is _FresnelPower (not _Fresnel).

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 Johan 4 · Apr 20, 2011 at 02:00 PM 0
Share

Yeah I know, I just used that as an example. As I said, I can get the value just fine, but I can't set it.

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

1 Person is following this question.

avatar image

Related Questions

Changing two different objects renderer colour 1 Answer

Webcamtexture not showing on a SpriteRenderer 0 Answers

Changing material color creates a memory leak 1 Answer

Access the nth materials in the renderer 1 Answer

Index array is out of range (following H&S tut) 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