Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 edo_m18 · Aug 08, 2019 at 04:31 AM · materialscript.renderer

Can I assign multiple materials to an object that has single mesh.

Hi. I'm working on a new asset creating. I have an issue to only iOS. That is what I can't assign multiple materials onto an object that has single mesh.

I tried to do it manually. I tried to assign any material onto a material list in MeshRenderer's material property in the inspector. It works well on PC / Mac. But I builded it to iOS, it didn't work on an iOS device.

I got an advice for it. He said, "Multiple materials are not defined, so you should duplicate an object or to use another way."

But it works well on PC / Mac. I want to know about working well on only iOS devices.

I show a code snippet of my script.

 Material[] materials = new Material[renderer.sharedMaterials.Length + 1];
 System.Array.Copy(renderer.sharedMaterials, materials, renderer.sharedMaterials.Length);
 materials[materials.Length - 1] = anyMaterial;
 renderer.sharedMaterials = materials;



Would anyone tell me about good way to it?

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
2

Answer by Meishin · Aug 08, 2019 at 05:21 AM

Hello @edo_m18,

Even for PC/MAC, you should avoid using several materials since it requires additional rendering passes, unless you use a specific shader (but in that case you would generally set the textures in the shader options directly, resulting in a single material).

The best way would be:

1- If your materials are always supposed to be together, blend your textures in a 3DModeling/Texture tool so as to create a unique material in the end

2- If you want to change part of the texture independantly, use a specific shader (if you don't want to create one, you can try Alloy "decals" for example)

Comment
Add comment · Show 5 · 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 edo_m18 · Aug 08, 2019 at 05:49 AM 0
Share

@$$anonymous$$eishin Thank you for replying! I'm planning to create a UnityAsset. So I can't know that how to be used my asset by my users. Please see below link that shows you what I want to create.

https://twitter.com/edo_m18/status/1158521519309381632

I want to project any texture to targets that using my asset. $$anonymous$$y asset will create a material for projection and assign to the target. So I can't create a new shader for the users.

Do you have any idea for it?

I really want to know that how about I can create an asset like the video. $$anonymous$$y decision is what assign my material to the target. It is easy way to show a projection texture that is my decision. But it is not necessary to create if any idea is.

avatar image Meishin edo_m18 · Aug 08, 2019 at 06:46 AM 0
Share

@edo_m18 Have you checked/Are you using projector in standard assets ? https://docs.unity3d.com/$$anonymous$$anual/class-Projector.html

avatar image edo_m18 Meishin · Aug 08, 2019 at 07:00 AM 0
Share

No, the projector system is $$anonymous$$e. I created original projector.

Show more comments

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

138 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

Changing two different objects renderer colour 1 Answer

How do I add a material to all of a parent's children and have the changes persist (ie w/ script)? 0 Answers

Trying to make a side scroller. I'm following a tutorial and getting this error. 1 Answer

appear/disappear gameobject 3 Answers

SetFloat doesn't work 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