Last active
April 26, 2022 09:38
-
-
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)
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
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