Skip to content

Commit

Permalink
fix default mat being missing in builds
Browse files Browse the repository at this point in the history
  • Loading branch information
hybridherbst committed Dec 2, 2022
1 parent 03bc55b commit 74c594e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions UnityGLTF/Assets/UnityGLTF/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this package will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.18.5-pre] - 2022-12-02
- fix: default material was missing in build

## [1.18.4-pre] - 2022-12-02
- fix: GLTFRecorder didn't properly record with animation pointer off anymore
- fix: unified access to SkinnedMeshRenderer weights on export
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,21 @@ public static Material DefaultMaterial
{
get
{
if(!_defaultMaterial) _defaultMaterial = new Material(Shader.Find("Unlit/Texture"));
if (_defaultMaterial) return _defaultMaterial;

#if UNITY_2019_3_OR_NEWER
var pipelineAsset = GraphicsSettings.currentRenderPipeline;
if (pipelineAsset)
{
_defaultMaterial = pipelineAsset.defaultMaterial;
}
else
#endif
{
var shader = Shader.Find("Legacy Shaders/Diffuse"); // by default in the always included shaders list
if (shader)
_defaultMaterial = new Material(shader);
}
return _defaultMaterial;
}
}
Expand Down
2 changes: 1 addition & 1 deletion UnityGLTF/Assets/UnityGLTF/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "org.khronos.unitygltf",
"displayName": "UnityGLTF",
"version": "1.18.4-pre",
"version": "1.18.5-pre",
"unity": "2019.4",
"description": "Unity3D library for importing and exporting GLTF 2.0 assets. https://github.com/KhronosGroup/UnityGLTF",
"keywords": [
Expand Down

0 comments on commit 74c594e

Please sign in to comment.