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 Gohu · Nov 30, 2012 at 09:48 AM · gameobjectmaterialchangedecal

Change material GameObject locally

Hi everyone,

I have a question, I'd like to change the material of a GameObject, but locally. But I wonder how it is possible to change locally (following the mouse for example) the material (like a spray of a painting)? This code changes totally the material :

 public class Painting : MonoBehaviour {
     public GameObject plan;
 
     void Update () {            
         if (Input.GetMouseButtonDown(1)) {
             planPeinture.renderer.material.color = Color.red;
         }
     }
 }


I hope I am clear enough. Thanks in advance!

Comment
Add comment · Show 9
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 DeveshPandey · Nov 30, 2012 at 12:27 PM 0
Share

your code will change the color or your material, what you want to do? would you like to change this material by another material that you have?

avatar image YM_Industries · Nov 30, 2012 at 01:21 PM 0
Share

Do you just want a Decal system?

avatar image Gohu · Nov 30, 2012 at 01:40 PM 0
Share

Hi I just want to change partially the color of my GameObject (like painting with a spray on the object). I don't know what is a Decal system, could you be more specific?

avatar image Gohu · Nov 30, 2012 at 04:53 PM 0
Share

Hi,

I just want to change partially the color of my object (like using a spray of painting on the object).

avatar image Loius · Dec 01, 2012 at 05:11 AM 1
Share

Ironically, that second comment could have been an edit. :)

Show more comments

1 Reply

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

Answer by YM_Industries · Dec 01, 2012 at 12:14 PM

It looks like you're looking for a decal system.

There are several ways you can go about implementing this:

  • If you're willing to get your hands a bit dirty, you can make your own system. The accepted answer on this question provides a useful starting place.

  • If you just want an off the shelf package, this asset package looks promising.

If you need any more help, feel free to ask me. It's also worth noting that I haven't tested either of the above solutions, so YMMV.

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 Gohu · Dec 05, 2012 at 10:52 AM 0
Share

Thank you very much! It works perfectly!

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

14 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

Related Questions

Change the material on an Object in a script? 2 Answers

How to change material of gameobject using C# to a material asset. 2 Answers

Player Material Change works on shop preview menu, does not change Player material on other scenes. 0 Answers

Changing gameObjects material on trigger? 1 Answer

Adding Decal to Tessellated Material 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