-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enforce BC7 texturing, set texarray material by default, remove prefa…
…b instantiation Merge pull request #21 from decentraland/feat/adding-texture-array feat: Added texture array
- Loading branch information
Showing
7 changed files
with
126 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...e-converter/Assets/AssetBundleConverter/LODsConverter/Editor/CustomLODFBXPostProcessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using UnityEditor; | ||
using UnityEngine; | ||
using Object = UnityEngine.Object; | ||
|
||
public class CustomLODFBXPostProcessor : AssetPostprocessor | ||
{ | ||
private void GenerateColliders(GameObject model) | ||
{ | ||
var meshFilters = model.GetComponentsInChildren<MeshFilter>(); | ||
|
||
foreach (var filter in meshFilters) | ||
{ | ||
if (filter.name.Contains("_collider", StringComparison.OrdinalIgnoreCase)) | ||
ConfigureColliders(filter.transform, filter); | ||
} | ||
|
||
var renderers = model.GetComponentsInChildren<Renderer>(); | ||
|
||
foreach (var r in renderers) | ||
{ | ||
if (r.name.Contains("_collider", StringComparison.OrdinalIgnoreCase)) | ||
Object.DestroyImmediate(r); | ||
} | ||
} | ||
|
||
private void ConfigureColliders(Transform transform, MeshFilter filter) | ||
{ | ||
if (filter != null) | ||
{ | ||
Physics.BakeMesh(filter.sharedMesh.GetInstanceID(), false); | ||
filter.gameObject.AddComponent<MeshCollider>(); | ||
Object.DestroyImmediate(filter.GetComponent<MeshRenderer>()); | ||
} | ||
|
||
foreach (Transform child in transform) | ||
{ | ||
var f = child.gameObject.GetComponent<MeshFilter>(); | ||
ConfigureColliders(child, f); | ||
} | ||
} | ||
|
||
private void OnPostprocessModel(GameObject model) | ||
{ | ||
if (model.name.Contains("_0")) | ||
GenerateColliders(model); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...verter/Assets/AssetBundleConverter/LODsConverter/Editor/CustomLODFBXPostProcessor.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
asset-bundle-converter/Assets/git-submodules/unity-shared-dependencies
Submodule unity-shared-dependencies
updated
20 files