Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 $$anonymous$$ · Jul 31, 2015 at 09:38 AM · texturetextureingchar

Char To Texture

I have one major issue in applying texture on object with respect to char. For e.g.: I have array of char[] which has like "R" "E" "D" of string "RED". so, with respect to this i want to apply these texture on single object each like on quad. Quad 1 has "R" of char[0] texture Quad 2 - "E" of char[1] and Quad - "D" char[2].

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 Graham-Dunnett ♦♦ · Jul 31, 2015 at 09:39 AM 0
Share

I have no idea what your question is asking.

avatar image $$anonymous$$ · Jul 31, 2015 at 12:13 PM 0
Share

@ Graham appreciate your concern, but i got the complete solution below.

1 Reply

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

Answer by shriya · Jul 31, 2015 at 11:06 AM

HI Suzit,

If I have understood correctly then the solution is mentioned below. Keep your Textures in Resources Folder and name your texture as per alphabet it contains (see attachment). This script is basically instantiating cubes equal to the length of your character array and applying texture to it..Output is also shown! For any clarification feel free to ask . Hope it helps.

 using UnityEngine;
 using System.Collections;
 
 public class ApplyTexture : MonoBehaviour {
     private char[] charac={'R','E','D'};
     public GameObject cube;
     // Use this for initialization
     void Start () 
     {
         for (int i = 0; i<charac.Length; i++) 
         {
             GameObject x = Instantiate(cube,new Vector3(i*2,0,0),Quaternion.identity) as GameObject;
             Texture gettexture =  Resources.Load (charac[i].ToString()) as Texture;
             x.GetComponent<Renderer>().material.mainTexture =gettexture;
 
         }
     }
     
 
 }
 


[1]: /storage/temp/51333-screen-shot-2015-07-31-at-42736-pm.png

[2]: /storage/temp/51334-screen-shot-2015-07-31-at-42955-pm.png


screen-shot-2015-07-31-at-42736-pm.png (12.8 kB)
screen-shot-2015-07-31-at-42955-pm.png (17.4 kB)
Comment
Add comment · Show 2 · 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 $$anonymous$$ · Jul 31, 2015 at 12:13 PM 0
Share

Damnnnn!!you shriya got the solution thanks a lot.

avatar image shriya · Jul 31, 2015 at 12:21 PM 0
Share

Happy to help :)

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

2 People are following this question.

avatar image avatar image

Related Questions

can I apply my camera photo image to unity model face? 0 Answers

Unnatural Texture Stretching 1 Answer

Assigning UV Map to model at runtime 0 Answers

Gray line at top of the texture 0 Answers

Texture blending 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