Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 TheCheatsrichter · Jun 01, 2016 at 02:41 PM · materialtexture2dlinerenderertextureingchange variable

Repeatable 2D Texture on Linerenderer

I try to create a Linerenderer (Positions update every Frame) which uses a texture that is repeated depending on the needed length.

Therefore I tried the following:

1) Creating a reapeatable texture

Texturepic

2) Creating a Material (Sprite/Default Shader) which uses this texture.

Matpic

3) Changing the texture's scale when needed:

 //Update Linderenderer
             linerenderer.SetPosition(0, transform.position);
             linerenderer.material.SetTextureScale("_MainTex", new Vector2(hook_joint.distance,1));
             Debug.Log(linerenderer.material.GetTextureScale("_MainTex"));

The Debug Log shows that the texture scale changes over time, the change is however not visible? Do i change the wrong texture on the material or is this kind of approach totaly wrong?

I allready found several answers to this question , which range from using special shaders to chaining linerenderers together (multiple linerenderers with fixed length) . Most of these answers however do not cover the use of a transparent key in the texture (my chain has holes ) or do only work in 3D.

unbenannt2.png (6.9 kB)
unbenannt.png (20.1 kB)
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 JoshDangIt · Jun 01, 2016 at 04:09 PM 0
Share

Have you seen this?: http://answers.unity3d.com/questions/548846/repeat-texture-ins$$anonymous$$d-of-stretching-it-all-over.html

avatar image alarm656 · Aug 30, 2017 at 03:06 PM 0
Share

What is "hook_joint.distance"?

2 Replies

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

Answer by TheCheatsrichter · Jun 02, 2016 at 11:05 AM

The shader Sprites/Default does not use any of he Texture Scale functions! I changed the material shader to standart and used the Cutout rendering mode to achieve the transparancy in the chain. After that the code from above works perfectly and the line renderer displays in the correct scale at each frame.

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
1

Answer by anil4029 · Jan 07, 2017 at 08:27 PM

change material shader to standard and then click on emission and choose same texture.

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

6 People are following this question.

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

Related Questions

Configure standard shader/material with Texture2Darray: how? 1 Answer

Texture breaking along center of mesh 1 Answer

Convert Texture to Texture2D e.g. renderer.material.mainTexture 3 Answers

Applying offset to a texture via script 1 Answer

Assigning script-generated textures 0 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