Where’s the emission? (Solved)

I’ve had a problem with the player interaction system. For some reason, in the standalone build the objects weren’t glowing when the player was looking directly at them.

A quick search on Unity Answers brought up this. It turns out that the standalone compiler only compilers shaders that are actually being referenced by an object in the scene. However, the objects that the player interacts with don’t reference the _EMISSION shader, so it wasn’t being included during the build.

Here’s two images to quickly show the difference. The first one shows the Editor, the second shows the build. In the second one, the object I’m looking at (an ammo box) is entirely unchanged.
Editor Screenshot
Build Screenshot

The solution, as provided by argosys_ops in the Unity Answers link above, is to add a cube with an emissive material to the scene and then build the scene. This will add the _EMISSION shader to the list of referenced shaders, and it’s now working in the build.

One thought on “Where’s the emission? (Solved)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.