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 Hogge · Nov 24, 2013 at 12:21 PM · shadertexturecolorpaintcars

Vehicle color select?

Hi. We're developing a racing game right now and something we feel to be an obvious feature is the ability to choose what colour your car should have. What I've been able to find so far has been the possibility of changing the colour of a whole material, but I'm after the ability to change the tint of specific parts of the texture. Essentially meaning that parts of the vehicle will be completely unchanged by my colour selections, while others are. The results should be like in the following picture:

alt text

As you can see, the two cars on the left are the same model, bot the green part on the top car has been replaced with red on the bottom one, while the yellow parts, taillights and other details in the texture remain unchanged. This is what I want to acheive. Anyone know how?

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 ozturkcompany · Nov 24, 2013 at 12:25 PM 0
Share

wouldn't it be easier if you would just call another texture on selection of the color? So you only change the texture on the material.Just make the whole car's body with one texture using uvw mapping and it will make things easier for you!So in this way create as much as textures with different colors with the parts of the body and just create an array that will hold all these textures then try to assign them on the selection

avatar image deadshot · Oct 16, 2014 at 06:46 AM 0
Share

hey @Hogge sir could you please tell me the script for changing vehicle color on gui button click as you have already done it.

i am stuck on that for almost 3 days.

i can change the color of a single surface like door or hood and i can also change the color of the car by keypresS BUT I CAN'T DO IT BY GUI BUTTON CLIC$$anonymous$$.

I WOULD REALLY APPRECIATE YOUR HELP.THAN$$anonymous$$ YOU

2 Replies

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

Answer by haim96 · Nov 24, 2013 at 12:31 PM

check this one:

https://www.assetstore.unity3d.com/#/content/2253

but i'm not sure if this editable texture in run time...

Comment
Add comment · Show 4 · 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 haim96 · Nov 24, 2013 at 12:34 PM 1
Share

this tutorial page say it should be possible:

http://www.creativetd.com/?page_id=775

avatar image Hogge · Nov 24, 2013 at 01:07 PM 0
Share

Seems promising. I'll ask our programmer to check it out :)

avatar image haim96 · Nov 24, 2013 at 01:16 PM 0
Share

yap, you can also change decals etc... which is cool. you can get endless option for coloring and customization options.

avatar image haim96 · Dec 04, 2013 at 07:02 AM 0
Share

if you found my answer helpful please close the question. thanks!

avatar image
0

Answer by deadshot · Oct 20, 2014 at 10:21 AM

  using UnityEngine;
  using System.Collections;
  
  public class texturechange : MonoBehaviour {
  
      public Texture[] Tex ;            
      public GameObject[] g=new GameObject[15];
      int maxTextures;
      int arrayPos = 0;
      //private int i=0;
      
  void Start ()
      {
           maxTextures = Tex.Length-1;
           //g.renderer.material.mainTexture=tex[i];     
      }
      
      
  void OnGUI () {
        if (GUI.Button(new Rect(15,15,100,50),"textures"))
          {      
              for(int i=0;i<15;i++)
              {
                  
                  g[i].renderer.material.mainTexture = Tex[arrayPos]; 
              }
                           
                  if(arrayPos == maxTextures)
                  {
                      
                      arrayPos = 0;                              
                  }
                  else
                  {
                      arrayPos++;
                  }
          }
      }
      }
  

make a dynamic array of surfaces of which you want to change the texture then apply the texture . you can also change the material in the same way

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

19 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

Related Questions

Multiple Cars not working 1 Answer

Changing Eye Colour (Colour only non-white parts of a texture?) 2 Answers

Colour tinting layered textures with transparencies. 1 Answer

Material doesn't have a color property '_Color' 4 Answers

Fade Shader emit background color 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