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 cadviz · Sep 06, 2012 at 05:27 AM · objectmaterials

How to change an object material using GUI buttons

Hi...

I have a scene with "First Person Controller" to move around, and 3 objects, I have a script to create 3 GUI buttons for 3 materials, that can be used for assigning a material to a selected object...

I need a script hleps me to achieve the following steps:

1- The mouse pointer position should be locked in the center of the screen.

2- An object get highlighted when mouse pointer is over it.

3- Select an object using left mouse button.

4- assign a material to the selected object through the 3 GUI buttons created previously.

Thanks in Advance.

Comment
Add comment · Show 6
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 asafsitner · Sep 06, 2012 at 07:13 AM 0
Share

Lock cursor

Highlight on $$anonymous$$ouse hover

React to $$anonymous$$ouse click

Change $$anonymous$$aterial

Good luck.

avatar image ThermalFusion · Sep 07, 2012 at 10:59 PM 0
Share

How do you click a GUI nutton(4) if you can't move your mouse pointer(1)?

avatar image cadviz · Sep 08, 2012 at 04:41 AM 0
Share

There are 2 ideas in my $$anonymous$$d to achieve my project...

First one:

Since I'm using "First Person Controller" to move around, so I am able to make my target object in the center of the screen "where the mouse pointer should be"... and in case I can select the object by mouse, then the 3 GUI buttons should be active and the mouse pointer should be free to be used.

Second one:

is to split the whole screen into 2 parts, the big for the scene "where the mouse should be locked" and the small one for GUI buttons at the bottom "where the mouse pointer must be free to move... Here are samples of I what I wish to create

http://www.youtube.com/watch?v=Y4t-C0pH1rs&feature=player_embedded

http://vimeo.com/34073227

avatar image Geine · Sep 08, 2012 at 06:11 AM 0
Share

the 1st video i watched seems to have an array of materials switching when hovered and clicked by the mouse button also the wall has another option to change it's color.

if your having split screen, one thing i know is have to cameras in the scene(the other one without audio listener in it), and adjust the other camera's normalized view port rect and depth.

avatar image cadviz · Sep 08, 2012 at 06:34 AM 0
Share

About splitting screen; although I didn't try it yet, but I think it can be done by specifying screen dimensions "as you say" with one camera... may be I don't know...

Anyway thanks for your interest and advice

Show more comments

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Having script accessing issues 2 Answers

Accessing a Certain Script 1 Answer

Fetching Objects that belongs to other script, with name or tag 1 Answer

How can i make an igniter that ignite objects? 1 Answer

Can't destroy a script. 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