oosidat / NASAHack2014-asteroids

Rocks! Lasers! Profit!
http://rockslasersprofit.com
Other
1 stars 1 forks source link

Highlight asteroid on click #20

Closed ssshake closed 10 years ago

ssshake commented 10 years ago

When you click and asteroid, highlight the border in a colour

ssshake commented 10 years ago

Sample code, to highlight on click. I think the best shader for this is one I used in another project called gems.shader.

using UnityEngine; using System.Collections;

public class Example : MonoBehaviour { 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;

}

}

oosidat commented 10 years ago

I'm attempting to deal with this... how do I set the renderer for an asteroid?

ssshake commented 10 years ago

done