CesiumGS / cesium-unity

Bringing the 3D geospatial ecosystem to Unity
https://cesium.com/platform/cesium-for-unity/
Apache License 2.0
358 stars 83 forks source link

Convert to generic Resources.Load calls for Texture2D #361

Closed kalvinpearce closed 1 year ago

kalvinpearce commented 1 year ago

Swapped out the manual casts in the Resources.Load calls for their generic equivalent so that Unity won't try to pick an invalid Texture2D with the same name.

This case arose when using the com.unity.vectorgraphics package. As I understand it, the Vector Graphics package overwrites the import type of .svg files and they are no longer able to be cast to Texture2D. This was causing a few of the Cesium editors to throw exceptions and not render anything to the inspector. By using the generic version of Resources.Load Unity will pick valid Texture2D (in this case, the .png files rather than the .svg).

j9liu commented 1 year ago

Thanks for the PR @kalvinpearce! Before we review, can you ensure that:

  1. you have signed a CLA with us, either individual or corporate
  2. you have updated CHANGES.md with a short description of the change? This sounds like it would go under the "Fixes" section, since it fixes bugs when using Cesium for Unity with com.unity.vectorgraphics.
kalvinpearce commented 1 year ago

🙇🏼 I can confirm I have now signed the CLA and updated CHANGES.md. Please let me know if you'd like me to adjust any wording or formatting of the changelog file.

j9liu commented 1 year ago

Looks great to me! Thanks @kalvinpearce 😄