Search Issue Tracker
By Design
Votes
9
Found in
4.3.4f1
Issue ID
594383
Regression
No
[Materials] Material.mainTexture does not work on editor scripts
To reproduce:
1. Open attached project
2. In the assets, navigate to Materials > UI > Mari_DIFF and delete the material
3. Reimport the texture located at Textures > UI > Mari_DIFF. A material is created and Material.mainTexture = texture is called, but the texture does not get assigned. You can inspect the newly created material at Materials > UI > Mari_DIFF
The script has no problem setting the material color, but it just can't set the main texture.
This is by design. We do not support assigning references to objects created by the importer.
The PersistentManager doesn't know about the newly created object until after the Import has finished, and as such the reference is lost when the object is unloaded.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Standalone Player crashes with "TDerived GetOrLoad<TDerived>() where TDerived : T" when IL2CPP Code generation is set to "Faster (smaller) Builds"
- IndexOutOfRangeException and InvalidOperationException when logging XML string
- Script missing in "Assets/Settings/Mobile_Renderer/GlobalVolumeFeature" of "com.unity.template.urp-blank" template
- “Font Asset Creator - Error Code [Invalid_File_Structure]…“ error is logged when generating Font Assets from fonts with meta files from previous Editor versions
- Input.mousePosition returns (NaN, NaN, 0.00) when Scene view is opened
Add comment