The Highlight component's built-in brightness effect occurs by it controlling the "_Color" property of its associated Material. If the sprite involved doesn't have this property, there'll be no visible effect.
To get around this in URP, you can either use Shader Graph to create a new Material that has such a property (and is used to control the sprite's brightness), or use the Highlight component's event hooks to trigger a separate custom effect. For example, this script on the AC wiki provides integration with the Easy Performant Outline asset.
I have another question regarding the highlight, I would like that the FlashHotspots function would highlight every interactable object in the scene without worrying about the interactive boundary. How would I go around this?
To try and investigate this, I had a test 2D project with the highlights working on unity version 2020.3.23f1 and AC version 1.74.5 (using the both the workaround shader and default materials.)
They stopped working when I updated AC to 1.75.3
I made multiple attempts with different materials on different projects and the demos.
This problem only seems to appear on 2D projects. 3D Works fine with all my tests.
I changed the script and it works for the custom shader and both default sprite material and urp unlit-sprite material, but not urp lit materials for sprites or 3D objects.
How does that compare with your encountered behaviour from AC v1.74.5 and v1.75.3?
The issue really comes down to AC trying to predict what material property needs to be controlled - in SRP this is "_Color", while often in HDRP/URP it's "_BaseColor".
I'm considering reverting this back to "_Color" by default, with an override field you can set in the Settings Manager which - if set - will be used instead. Does that sound like a workable approach to you?
I'm considering reverting this back to "_Color" by default, with an override field you can set in the Settings Manager which - if set - will be used instead. Does that sound like a workable approach to you?
Hey Chris - this worked perfectly, but wasn't documented anywhere so it took me a while to track down. I am using the Universal Render Pipeline/Lit Shader. I set the AC Game Creator Settings -> Hotspot Settings -> "Highlight material override" to "_BaseColor", and this worked. Thank you!
My apologies for the hassle. It is covered in the Manual's "Highlight" chapter, but I agree that it should be made more prominent - thanks for bringing it to my attention.
Comments
The Highlight component's built-in brightness effect occurs by it controlling the "_Color" property of its associated Material. If the sprite involved doesn't have this property, there'll be no visible effect.
To get around this in URP, you can either use Shader Graph to create a new Material that has such a property (and is used to control the sprite's brightness), or use the Highlight component's event hooks to trigger a separate custom effect. For example, this script on the AC wiki provides integration with the Easy Performant Outline asset.
I'm not a master in coding but for a 3D project I just changed the highlight script line 61
private string colorProperty = "_Color";
to
private string colorProperty = "_BaseColor";
And it works.
I don't know if this:
#if UNITY_2019_3_OR_NEWER if (GraphicsSettings.currentRenderPipeline && GraphicsSettings.currentRenderPipeline.GetType ().ToString ().Contains ("HighDefinition")) { colorProperty = "_BaseColor"; } #endif
Could be modified to include the URP?
I'm not sure how to have similar change for the 2D.
Unsure - IIRC 2D URP is technically separate to "regular" URP. I shall look into it, however.
Ok so I got the Shader Graph material working, does this look correct? I'm not familiar with the subject.
The highlight works as intended with this.
I have another question regarding the highlight, I would like that the FlashHotspots function would highlight every interactable object in the scene without worrying about the interactive boundary. How would I go around this?
Looks good to me.
You can use a custom script that handles the effect manually based on a separate input:
Ah, Thank you!
@Kisuarts unity2021.3.2 The highlight script failed again.
Which script are you referring to - CustomFlashHotspots or the discussed changes to AC's Highlight component?
In AC 1.75.2 and later, URP's Lit shader should react to AC's Highlight effects.
To try and investigate this, I had a test 2D project with the highlights working on unity version 2020.3.23f1 and AC version 1.74.5 (using the both the workaround shader and default materials.)
They stopped working when I updated AC to 1.75.3
I made multiple attempts with different materials on different projects and the demos.
This problem only seems to appear on 2D projects. 3D Works fine with all my tests.
Thanks for the details, @Kisuarts, I will attempt a recreation.
What URP version are you testing with?
As a test, open up AC's Highlight.cs component, and find the line block 88-97:
Replace it with:
Does that resolve it?
I'm using URP version 10.7.0
I changed the script and it works for the custom shader and both default sprite material and urp unlit-sprite material, but not urp lit materials for sprites or 3D objects.
How does that compare with your encountered behaviour from AC v1.74.5 and v1.75.3?
The issue really comes down to AC trying to predict what material property needs to be controlled - in SRP this is "_Color", while often in HDRP/URP it's "_BaseColor".
I'm considering reverting this back to "_Color" by default, with an override field you can set in the Settings Manager which - if set - will be used instead. Does that sound like a workable approach to you?
I think the behavior is pretty much the same if I recall correctly. I believe the approach you suggested is a good way to go.
Hey Chris - this worked perfectly, but wasn't documented anywhere so it took me a while to track down. I am using the Universal Render Pipeline/Lit Shader. I set the AC Game Creator Settings -> Hotspot Settings -> "Highlight material override" to "_BaseColor", and this worked. Thank you!
Welcome to the community, @JakeT.
My apologies for the hassle. It is covered in the Manual's "Highlight" chapter, but I agree that it should be made more prominent - thanks for bringing it to my attention.