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 Frix · Nov 30, 2012 at 07:08 PM · materialinspector3dtext

Changing the colour of a 3DText through script gives a weird error

SCREENSHOTS GOT MESSED UP, CANT EMBED AND THEY'RE IN THE WRONG ORDER.

I want to change the colour of 3D text through a script, and the first time you use it, it works perfectly fine. No problem there. But the first time the text pops up, the 'Element 0' changes to 'Type mismatch', and then when you stop the game, it turns into screenshot 2.

Then the next time you start the game, the text will turn into screenshot 1.

Then you have to keep on reassigning the font material in the inspector every single time you want to start the game again. I am using a custom font, and this is my code for changing the colour: goldMesh.renderer.material.color = Color.yellow; which works perfectly fine before it spazzes out.

(edit: okay, the screenshots wont appear correctly for some reason, so just click on attachments)

wwq.png (8.0 kB)
wwe.png (613 B)
Comment
Add comment · Show 3
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 GerryM · Nov 30, 2012 at 09:54 PM 0
Share

Did you select the font in the "Text $$anonymous$$esh" component (last entry)? When you select a proper font you should not have to bother with the material settings in the "$$anonymous$$esh Renderer".

Does changing the color work when you change the font import settings?

What version are you using? 4.0? Pro?

Sometimes a simple restart of the editor (especially on windows) does help with some weird errors.

I can change the font color with your code line fine, several times, no issues here. (Unity 4.0.0f7 Pro)

avatar image Frix · Nov 30, 2012 at 10:03 PM 0
Share

Yeah, when I put the font onto it, I didn't need to change anything else. It worked perfectly. It's just the script that's messing it up, it seems to remove it from the component or something.

I don't know what you mean about the import settings. What could I change?

I'm using 4.0.0f7 Normal version.

I restarted. Still being weird.

I also totally forgot to mention that it comes with this error whilst the text popups weirdly: 'Shader wants normals, but the mesh doesn't have them'

avatar image GerryM · Dec 01, 2012 at 07:10 PM 0
Share

When you select the font in your project you can change the input settings, like "Font Color". If changing it there works, it's probably not a font issue.

Perhaps you can post the script, the one line you did post works fine.

Also, you can try everything in a new project, add a font, add a 3DText, finally add your script. $$anonymous$$ight help narrowing down the error.

Check here for the same error.

0 Replies

· Add your reply
  • Sort: 

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

12 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

Related Questions

Generated meshes/materials cannot be made into prefabs? 1 Answer

HDRP shader graph - Surface options missing "Material Type" in inspector 0 Answers

Is it possible to create a Material _asset_ from a script? 3 Answers

Assigning meshes & materials from Assets, how? 1 Answer

How do I add a tool tip for class variables in the inspector? 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