I did some more investigating today and have found out more concerning this issue.
So if a scene material channel has a texture assigned to it in the editor (AlbedoPBR) , at runtime the scene graph object for that channel does not have a color property.
So if as above i try remove the texture property ( setting to null and deleting ) I get the console warnings shown above and also nothing happens in the scene.
I then tested setting a color for the channel just before I remove the texture. As mentioned the color property does not exist so i just create it and set it.
This works and the color is set and the texture is removed. I still get the console warnings though which is not good.
So next I thought let me just test setting a color and not deleting the texture , thinking perhaps it is just a preference condition in your engine. This did not work.
So to end the final conclusion to remove a scene texture from a channel (AlbedoPBR) :
• You have to create and set the color property on the channel before deleting the texture.
• You have to remove/delete the texture property of the channel ( this is expected )
• You can expect the same warnings in the console, exactly the same as if you tried to remove the texture without first setting the color. ( only difference is something actually happens in the scene now at least )
Also I tried to leave the texture object in place and just “null | undefined | 0” the uid property value, this removed the warnings but produced an error " cannot find image model of “null | undefined | 0” so that was not possible.
Seems you cant escape those warnings. This needs to be looked into obviously
Ideally I cant think why you omit the color property even when a texture is set in the editor. I would expect you can set the color , the color will persist and then you can set a texture as well.
The texture would just take precedence and if it exists it is used and color ignored ( not left out ) The data size to keep the color around is trivial.
Then if you remove the texture via the api the color of the channel would be what was set in the editor. If it was not manually set it would default to you near white value you currently use in the editor already. No need to create and set a color via code at runtime just to be able to remove a texture. The color property should always be there, and there should be no console warning when doing this.