[Tooltip("If using a Sprite Renderer it will use the material property instead of sharedMaterial"), SerializeField]privatebooluseMaterialInstanceIfPossible=false;
EditorUtility.DisplayDialog("No sprite found","The object: "+gameObject.name+", has Sprite Renderer but no sprite","Ok");
#endif
DestroyImmediate(this);
returnfalse;
}
if(render==null)render=GetComponent<Renderer>();
isUI=false;
}
else
{
if(uiImage==null)
{
uiImage=GetComponent<Image>();
if(uiImage!=null)
{
#ifUNITY_EDITOR
Debug.Log("You added the SetAtlasUv component to: "+gameObject.name+" that has a UI Image\n "+
"This SetAtlasUV component will only work properly on UI Images if each Image has a DIFFERENT material instance (See Documentation Sprite Atlases section for more info)");
#endif
}
else
{
#ifUNITY_EDITOR
EditorUtility.DisplayDialog("No Renderer or UI Graphic found","This SetAtlasUV component will now get destroyed","Ok");
#endif
DestroyImmediate(this);
returnfalse;
}
}
if(render==null)render=GetComponent<Renderer>();
isUI=true;
}
if(spriteRender==null&&uiImage==null)
{
#ifUNITY_EDITOR
EditorUtility.DisplayDialog("No Renderer or UI Graphic found","This SetAtlasUV component will now get destroyed","Ok");