so i have a simple test script to change the animator during runtime so that i can add multiple skins to a 2d character but keep its animations, the animator im trying to access is in the assets folder but it doesn’t seem to be working
Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SkinSwitcher : MonoBehaviour {
public Animator BirdSprites;
// Use this for initialization
void Start () {
BirdSprites = GetComponent<Animator>();
BirdSprites.runtimeAnimatorController = Resources.Load("Assets/Bird1") as RuntimeAnimatorController;
}
// Update is called once per frame
void Update () {
}
}
“All assets that are in a folder named “Resources” anywhere in the Assets folder can be accessed via the Resources.Load functions. Multiple “Resources” folders may exist and when loading objects each will be examined.”
“The path is relative to any Resources folder inside the Assets folder of your project”
(Resources.Load need a Resource folder to be able to Load a file)