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 adgrist · Jul 27, 2012 at 03:23 PM · clampprojectorwww.texture

www.texture on Projector wont clamp

I am trying to change the texture used on a projector at runtime from a texture on my server. I have managed to get working, when not building to web player, but the texture won't clamp. It is repeating even though I have tried to get it in the script. I'm sure it is something basic I am not doing, but I'm trying to pick up scripting as I go along. here is my code

public class ProjectorTextureLoad : MonoBehaviour

{

     public int desiredWidth = 1024;
     public int desiredHeight = 512;
     private Texture2D _texture;

public string url = "http://mylogo.png";

IEnumerator Start () {

WWW www = new WWW(url);

_texture = new Texture2D(desiredWidth, desiredHeight, TextureFormat.ARGB32, false); _texture.wrapMode = TextureWrapMode.Clamp; _texture.Apply(false);

     yield return www;
 

Projector proj = gameObject.GetComponent();

proj.material.SetTexture("_ShadowTex", www.texture); } }

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Zerot · Jul 27, 2012 at 07:18 PM

Just skimmed over it, but it looks like you are creating a new texture and storing it in the variable _texture and then set the texture using www.texture. Those are 2 different objects, so setting the clamping on _texture has no effect.

Before "proj.material.SetTexture("_ShadowTex", www.texture);" add the line "www.texture.wrapMode = TextureWrapMode.Clamp;" and it should work fine.

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 adgrist · Jul 28, 2012 at 12:04 PM 0
Share

Thanks mate really appreciate that. it totally makes sense too. I have cut the script down now too as some of it isn't needed like creating the _texture. Unfortunately it is still working as before, the clamp just wont seem to work on that www.texture before it is being applied to the projector

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

6 People are following this question.

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

Related Questions

How to scale an object between two values over distance 1 Answer

How to clamp ovally? 1 Answer

2D GunPivot Bug 1 Answer

Clamping velocity and angular velocity at the same time? 0 Answers

How to limit a rigitbody to an area 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