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 vib5252 · Oct 25, 2011 at 07:13 PM · triggerbackground3d modelhighlight

Highlighting background triggered from a 3d model

Hi Guys,

I am fairly new to unity and am trying to figure out how to trigger a game object (this has the highlight script) that highlights itself. Right now the problem is that when i hover over the gem (3d model) i don't trigger the game object that highlights itself (grid tile).

[file A]

At present the gem is highlighted like this:

 public void Highlight()
 {
     m_isHighlighted = true;
     renderer.material.color = m_highlightColor;
 }

This just highlights the gem, but I want to highlight its background.

I made another game object and place it on the current tile and added this highlight script to it:

[File B]

 using UnityEngine;

using System.Collections;

public class HighlightTile : MonoBehaviour {

 private float blueMultiplier = 3.50f;
 private float redGreenMultiplier = 0.50f;
 private Color originalColor;
 
 // Use this for initialization
 void Start () {
    originalColor = gameObject.renderer.material.color;
 }
 
 void OnMouseEnter()
 {
     AddHighlight();
 }
 
 void OnMouseExit()
 {
     RemoveHighlight();
 }

 public void  AddHighlight() 
 {
     float red = originalColor.r * redGreenMultiplier;
     float blue = originalColor.b * blueMultiplier;
     float green = originalColor.g * redGreenMultiplier;

     gameObject.renderer.material.color = new Color(red, green, blue);
 }

 public void RemoveHighlight()
 {
     gameObject.renderer.material.color = originalColor;
 }

}

Ideally I would like to highlight the gem and the grid in the background. Any feed back is appreciated, thanks

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 ramonthepsycho · Sep 18, 2016 at 06:14 PM 0
Share

Thank you for this sir!

Anyway, Im currently using Unity4 for my thesis, a firstperson view game. Is it possible to highlight the object when it is available to hit? I mean, when it is on ranged of my character's mallet? Like in other games when you're about to loot items it highlight the object.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Can't click gameobject when over another trigger? 1 Answer

2D Sprite Background Rendering 1 Answer

OnTriggerEnter not working on terrain in 3.5 beta 0 Answers

Color custom editor window ? 2 Answers

how to force a trigger to detect enemy not moving 3 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