Skip to content

Instantly share code, notes, and snippets.

@partiallyblind
Last active April 26, 2022 09:38
Show Gist options
  • Save partiallyblind/213af7a47d3b14e6b292958b4703e5d7 to your computer and use it in GitHub Desktop.
Save partiallyblind/213af7a47d3b14e6b292958b4703e5d7 to your computer and use it in GitHub Desktop.
Skinned Mesh Renderer Bones reset from UnityCodeMonkey (https://www.youtube.com/watch?v=nSmEirb8JGM)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TestSkinnedMeshRendererBones : MonoBehaviour {
[SerializeField] private SkinnedMeshRenderer skinnedMeshRendererPrefab;
[SerializeField] private SkinnedMeshRenderer originalSkinnedMeshRenderer;
[SerializeField] private Transform rootBone;
private void Start() {
SkinnedMeshRenderer spawnedSkinnedMeshRenderer = Instantiate(skinnedMeshRendererPrefab, transform);
spawnedSkinnedMeshRenderer.bones = originalSkinnedMeshRenderer.bones;
spawnedSkinnedMeshRenderer.rootBone = rootBone;
foreach (Transform bone in originalSkinnedMeshRenderer.bones) {
Debug.Log(bone);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment