Hey guys.
I’m working on a mechanic to highlight objects when they are interactable in a 3D game. For this I’m currently using this shader: http://wiki.unity3d.com/index.php/Silhouette-Outlined_Diffuse
I had the idea that in every frame I would do a Raycast from the center of the screen. If it hits an object with the interactable-script(a script from me) attached to it and it is in range to interact, then I’d display “Interact” on the screen to tell the user that there is an interaction available. This mechanic works until here.
Since I want to “highlight” it a little more I added this shader. Whenever I would display that “Interact Message” thing, I’d like to set the outline width(Property of the shader) to a value to “activate” the outlining. If I’m not in range or the Ray doesn’t hit the object, the outline width is then 0.
I didn’t write the shader and I’m fairly new to shaders. The real question is: How can I manipulate the “Outline width” of this material via script? I tried something with material.SetFloat(“unknownNameOfProperty”, float); I also read on the internet that I have to use activateKeyword(“unknownNameOfProperty”);
For the string that I passed in these functions I tried many things like “Outline width”, “outline width”, “_Outline_Width” and many many more. I just can’t figure out how to do this.
If you guys could help me, I’d be really thankful
Answers preferebly in C# but JavaScript would be okay I guess. And if you have another, maybe more efficient, method for this problem please tell me
Thank you in advance