Last active
April 14, 2023 21:32
-
-
Save afterburn/6cad959ff8ea27b12455755e9748bac0 to your computer and use it in GitHub Desktop.
Synchronizes the bones of one SkinnedMeshRenderer with another
This file contains hidden or 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; | |
[ExecuteAlways] | |
public class BoneSynchronizer : MonoBehaviour | |
{ | |
public SkinnedMeshRenderer proxy; | |
void Start() | |
{ | |
foreach (SkinnedMeshRenderer smr in GetComponentsInChildren<SkinnedMeshRenderer>()) | |
{ | |
if (smr != proxy) { | |
smr.bones = proxy.bones; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment