I'm really struggling with a issue where my material does not hold a unique instance per material im using a texture for my baked blender ambient occlusion map. Im using a Texture2D exposed to the editor, the scope is per material. GPU instancing is off. This worked before i restarted unity today. Everything was fine.
Whenever i change the 2dTexture in the editor on one material it changes it for all objects in the scene using this material >< In fact I'm noticing all exposed variables are now shared across all objects with the same material. How do i make them unique per object?
Thanks so much for the help.
#I cannot seem to have a Unique texture per Material from a shader graph. Works then does not.
1 messages · Page 1 of 1 (latest)
If you want different values per object you should assign different materials
If i assign different materials, i have 200 world tiles per level, and 20 levels, thats alot of materials would that be normal? I mean the unique map per object was working before i dont know what changed : (
Is there no way to have the same material but with different values per instance of the material?
void Start()
{
Renderer renderer = GetComponent<Renderer>();
Texture2D uniqueTexture = texture;
MaterialPropertyBlock block = new MaterialPropertyBlock();
renderer.GetPropertyBlock(block);
block.SetTexture("_AOMap", uniqueTexture);
renderer.SetPropertyBlock(block);
}```
Material block works. hmm
So strange this is not an option in shader graph? This is what i think im missing or something
So i really dont want to use this way is my object is an enttiy and not a gameobject, so ide would be nice to do it through the shader ><
You'd typically want to access renderer.material (which creates a duplicate/instance for you) in URP rather than rely on MaterialPropertyBlocks as the latter breaks the SRP batcher
Thanks : )
https://docs.unity3d.com/Packages/com.unity.entities.graphics@1.3/manual/material-overrides-asset.html this documentation shows that i should have a Override Property Declaration property in my shader but its simply not there? This is how we do it i think??
Ok this does not work for 2DTexture. Nvm.
There must be a way to change the 2DTexture within entities/dots per material instance?