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 papamck · Apr 06, 2012 at 05:57 PM · effectmouseover

effect of an object when mouseover

When an object(which import from 3DSMAX) mouseover
I want it looks a bit different (for example show border or lighten)
what script should I use?

I am using
public class example : MonoBehaviour { void OnMouseEnter() { } } for mouseover function
thx for your help

Comment
Add comment · Show 1
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 papamck · Apr 07, 2012 at 05:41 AM 0
Share

i am trying this method to change

using UnityEngine; using System.Collections;

public class example : $$anonymous$$onoBehaviour { public Shader shader1 = Shader.Find("Diffuse"); public Shader shader2 = Shader.Find("Transparent/Diffuse"); void Update() { if (Input.GetButtonDown("Jump")) if (renderer.material.shader == shader1) renderer.material.shader = shader2; else renderer.material.shader = shader1;

 }

}

but nothing comes out... how come

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by darkcookie · Apr 07, 2012 at 06:23 AM

try this it makes the object red

 var initialColor : Color;
 
 function Start()
 {
    initialColor = renderer.material.color;
 }
 
 function OnMouseOver()
 {
    renderer.material.color = Color.red;
 }
 
 function OnMouseExit()
 {
    renderer.material.color = initialColor;
 }
Comment
Add comment · Show 6 · 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 papamck · Apr 07, 2012 at 06:28 AM 0
Share

i think i find the problem...
it works after i add the collider...but i really dunno what is collider stand for
however thanks for your reply

avatar image darkcookie · Apr 07, 2012 at 06:37 AM 0
Share

as for a collider just ad a box collider and you should be fine....*note colliders can be used as triggers or for physics

avatar image papamck · Apr 07, 2012 at 08:32 AM 0
Share

here come a question
I have a group of objects and I want to mouseover either one and the whole group will change color
I put the script to the group but doesnt work...so do i need to write script for every single one?

avatar image darkcookie · Apr 07, 2012 at 09:19 AM 0
Share

well no just call the function GameObject.FindWithTag (tag name)

http://unity3d.com/support/documentation/ScriptReference/GameObject.FindWithTag.html

avatar image papamck · Apr 07, 2012 at 09:49 AM 0
Share

so i have to tag every child or just the parent?

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Built in Glass Stained Bump distort on Particles 0 Answers

Audio Low Pass Filter Not Working 1 Answer

In what way would be best to achieve a retro Gameboy simulation 0 Answers

How can I do such as that effect for my water sprite in Unity? 1 Answer

How to make Sword Trail Effect 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