Fix MaleExplorer setup with shadow material and editor diagnostics.
Improve FBX/prefab import setup, CharacterSpawner, and add M3 inspect/rebuild helpers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
public static class InspectMaleExplorer
|
||||
{
|
||||
public static string Execute()
|
||||
{
|
||||
const string path = "Assets/Bundles/Characters/MaleExplorer/MaleExplorer.prefab";
|
||||
var prefab = AssetDatabase.LoadAssetAtPath<GameObject>(path);
|
||||
if (prefab == null) return "prefab null";
|
||||
|
||||
var go = (GameObject)PrefabUtility.InstantiatePrefab(prefab);
|
||||
go.name = "MaleExplorer_Inspect";
|
||||
go.transform.position = new Vector3(0f, 0f, 2.5f);
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine($"root scale={go.transform.localScale} pos={go.transform.position}");
|
||||
foreach (var r in go.GetComponentsInChildren<Renderer>(true))
|
||||
{
|
||||
var mat = r.sharedMaterial;
|
||||
sb.AppendLine(
|
||||
$"renderer={r.GetType().Name} path={GetPath(r.transform)} enabled={r.enabled} " +
|
||||
$"bounds={r.bounds} mat={(mat ? mat.name : "null")} " +
|
||||
$"shader={(mat && mat.shader ? mat.shader.name : "null")}");
|
||||
}
|
||||
foreach (var mf in go.GetComponentsInChildren<MeshFilter>(true))
|
||||
{
|
||||
sb.AppendLine(
|
||||
$"meshFilter={GetPath(mf.transform)} mesh={(mf.sharedMesh ? mf.sharedMesh.name : "null")} " +
|
||||
$"verts={(mf.sharedMesh ? mf.sharedMesh.vertexCount : 0)}");
|
||||
}
|
||||
foreach (var smr in go.GetComponentsInChildren<SkinnedMeshRenderer>(true))
|
||||
{
|
||||
sb.AppendLine(
|
||||
$"skinned={GetPath(smr.transform)} mesh={(smr.sharedMesh ? smr.sharedMesh.name : "null")} " +
|
||||
$"verts={(smr.sharedMesh ? smr.sharedMesh.vertexCount : 0)}");
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
static string GetPath(Transform t)
|
||||
{
|
||||
var p = t.name;
|
||||
while (t.parent != null)
|
||||
{
|
||||
t = t.parent;
|
||||
p = t.name + "/" + p;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user