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 weedmastersr · Jan 19, 2016 at 08:19 AM · prefabcolorthird-personshooter

How to make a character of a random color each time the game starts

Hello everyone. I'm not exactly sure how to approach this as I'm a noob. I'm making a third person shooter and I'm using the standard third person character model, as it works pretty well for my game.

However, I want the character to have a random color every time I start the game. I would also like for a prefab which the shooting script shoots out of the character's body, to take the color of the character. That's pretty much it. Can you please help me out with that? Thank you in advance!

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 Dave29483 · Jan 19, 2016 at 08:29 AM 0
Share

I presume you mean fixed $$anonymous$$m colours and not any old random colour?

-You could either have multiple materials for each $$anonymous$$m colour. (Different albedo textures).

  • you could use an emission map and just modify it's colour. (Glow in the dark colour bands on the model)

  • you could modify the colour tint on the material, but this may be too simplistic in look.

For either of the options you could keep a list of $$anonymous$$m colour materials and apply them to your character based on the randomly selected $$anonymous$$m.

Or if you actually did want a totally random colour, just modify the material properties ins$$anonymous$$d of swapping materials.

avatar image weedmastersr Dave29483 · Jan 27, 2016 at 06:56 PM 0
Share

Sorry, I should've been more clear. I actually mean a completely random color. How do I just modify material properties? Is there a simple script I could use for this?

avatar image weedmastersr Dave29483 · Jan 27, 2016 at 06:57 PM 0
Share

Oh, and thanks for your help!

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by ForeignGod · Jan 19, 2016 at 09:26 AM

There is many ways to do this.

One way is to use Random.Range(x, x); in the Start function to assign a int variable when your game and script starts.

Then in the Update function check the variable and decide color depending on int value.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Problem getting prefab color 0 Answers

Change text color for multiple text elements at once 1 Answer

change the colour of mass placed tree leaves (or make them transparent) 1 Answer

Renderer.material.color not changing color of prefab 3 Answers

UI Text.color not assigning? 2 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