I would like to change material of a gameobject with a bitmap dynamically created at runtime or a bitmap read from a database. How can I do this? Thanks.
Lets say you have two variables (I will make them public so they can be set through the inspector) like this
public Sprite sprite;
public Material material;
You can then set the main texture of the material using the following code
if ((sprite != null) && (material != null))
{
material.SetTexture("_MainTex", sprite);
}