Skip to main content
6 votes
Accepted

Material changes to "material (instance)" on Start

When you access a renderer's material with the .material getter, Unity instantiates a new copy of the material unique to this object — that's why you see an "(...
DMGregory's user avatar
  • 135k
5 votes
Accepted

Unwanted highlight on far side of objects near the edges of the screen when using orthographic camera

The default shaders in Unity 5+ use something called physically-based rendering. This means they try to model a number of quirks we observe in real materials, which aren't included by the Lambertian/...
DMGregory's user avatar
  • 135k
5 votes
Accepted

Unity: How do I only show parts of objects that overlap [2D]

First, create a simple mesh (such as a quad or a cube). Place it over top the actual game area, and stretch it so that it covers the entire camera view. Next, create a new shader named "...
Coffee Boat's user avatar
5 votes

Why are all materials pink in my Unity URP project?

To upgrade built-in Shaders (ref): Open your Project in Unity, and go to Edit > Render Pipeline > Universal Render Pipeline. According to your needs, select either Upgrade Project Materials to ...
Muhammad Faizan Khan's user avatar
4 votes

Change color, or material of specific line segments on Line Renderer

Here's an example of what you can do with a single material and a shader that changes behaviour based on world position: This shader looks something like this: ...
DMGregory's user avatar
  • 135k
4 votes
Accepted

Creating paralax background in Unity3D

When importing a texture, you can set two different 'wrap modes'. These tell the renderer what to do when the UV map goes past the edges of the texture. Yours is set to 'clamp', which will just ...
Robin van Ee's user avatar
4 votes
Accepted

What game objects can have a "material"?

There are actually two completely unrelated kinds of materials in Unity: Renderer materials (which define how things are rendered) and physics materials (which define how rigidbodies behave when they ...
Philipp's user avatar
  • 121k
4 votes
Accepted

How do materials and shaders work in graphics programming?

A shader is simply a program that runs on the GPU. Shaders are most often used to determine how a mesh is rendered, but can be used for many other things as well. Rendering meshes The most common use ...
Kevin's user avatar
  • 6,494
3 votes

Can't change materials of model from FBX

Inside the import settings inspector for your model, change from "Use Embedded Materials" to "Use External Materials (Legacy)". You will then have a Materials Folder to modify.
Fred Ip's user avatar
  • 31
3 votes
Accepted

Emission on part of the mesh

When you set the UVs for your model, make sure the faces which are supposed to have a different material get assigned to different images. When you then import the model into Unity, you will have a ...
Philipp's user avatar
  • 121k
3 votes
Accepted

How can I update my materials to work with LWRP?

To upgrade all the materials that can be supported by LWRP, go to: Edit Menu -> Render Pipeline -> Lightweight Render Pipeline -> Update Project Materials to LightweightRP Materials Note - only ...
Dr Rob Lang's user avatar
3 votes
Accepted

How to Convert Sprite into Texture

...
virtouso's user avatar
  • 2,650
3 votes

How can I make the hue of a material change over time?

Here's how to write a shader that applies this effect. I'm assuming you want lighting, so I started this shader by right-clicking in the Project view and selecting Create -> Shader -> Standard ...
DMGregory's user avatar
  • 135k
2 votes

How to have random and different colors on multiple objects with one material?

You can change the color of the same material, on different objects, from script. Do the following: Create a materialand assign it to the target game object. Create a new C# script, and copy in the ...
Shuvro Sarkar's user avatar
2 votes

UE4 How to Avoid Boundary Seams with Multiple Refractive Meshes

You don't say if your boxmodel uses separate materials per face - if not, I suggest that you do this. Then pre-pass each face before drawing the block, checking for a water block against each face; if ...
JonS's user avatar
  • 299
2 votes
Accepted

How to make player stay on a moving object

You don't have to apply any Force or Velocity to your player. Just set your player child of the current Obstacle, and it will stick to that Obstacle. ...
Aditya Yadav's user avatar
2 votes
Accepted

How to make a static Material reference?

Quite often I'll use a ScriptableObject to hold this kind of shared data. It's similar to OC_RaizW's suggestion of a ...
DMGregory's user avatar
  • 135k
2 votes
Accepted

Using 10 materials for one Model?

It's most likely that for every material the pipeline needs to change state and validate a lot of stuff. Which means you'd end up with a shaderpass for each material. Depending on the scope of your ...
Sidar's user avatar
  • 3,577
2 votes

Using different shaders based on desktop or mobile?

You can also use shader compile directives in custom shaders to skip over expensive sections, resulting in a simpler look, which only triggers when on a mobile device. https://docs.unity3d.com/...
Draco18s no longer trusts SE's user avatar
2 votes

Using different shaders based on desktop or mobile?

It may lead to longer load times, but you could switch shaders in Awake based on the platform: ...
noone's user avatar
  • 96
2 votes

Why does my line disappear against a white image?

It should be because the alpha channel of the line is set to 0, so the Unlit/Transparent shader effectively makes it invisible when there're other objects rendered ...
Galandil's user avatar
  • 1,284
2 votes
Accepted

How to stop and start sprite sheet flipbook materials in a widget blueprint?

Add a Time node and Multiply node. Take the Time node and pass it as an input to the Multiply, add a float parameter as the other input on the multiply node then plug the output of the multiply into ...
dave's user avatar
  • 36
2 votes

Difference between Material and Shader

Although late, there is a "cheat" which can help you understand better. A material is everything that is attached to a certain shader for that draw call. For example, in the above answer, you have ...
Adrian Voinea's user avatar
2 votes
Accepted

How can I make Iridescence material In unity?

I found same question here and I could make Iridecence In unity . you can download this shader from my github. My tutorial About Iridescence Shader Iridescence (also known as goniochromism) is ...
Seyed Morteza Kamali's user avatar
2 votes
Accepted

How to target specific material with Unity VideoPlayer?

First of all create a RenderTexture in your project with the width and height matching your VideoClip for best performance. Change RenderMode from MaterialOverride to RenderTexture Set the ...
buffalo94's user avatar
  • 116
2 votes

How to do "realistic" plastic material?

Use a standard shader for simple materials. If you are looking how to modify the standard shader to achieve a plastic-y effect, consult the documentation on material effects. On the site it says that ...
Samuel Lopes's user avatar
2 votes

Sprite brighter than texture

Check the camera and light settings. The default camera uses eye adaptation to make everything in dark scene gradually brighter.
TheBrain's user avatar
  • 307
2 votes
Accepted

How to add material to a blueprint created?

Materials can only be applied to some subclasses of UPrimitiveComponent, like UStaticMeshComponent. If you select the StaticMeshComponent of your Capsule actor in its components list (in the Details ...
CourageousPotato's user avatar
2 votes
Accepted

How to reference a GameObject from the Scene Hierarchy in C#?

The simplest way is to expose a public variable of the types you want to work with: ...
DMGregory's user avatar
  • 135k
2 votes

How to make a texture appear the same way in a cube?

You might want to play around with texture coordinate (UVs) scaling and flipping. Right now, the face pointing upwards is just showing a part of the unfolded cube texture. If you adjust the scale you ...
Harald3DCV's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible