Edit: The solution I found was discovering that AssetDatabase.LoadAssetAtPath did exactly what I was trying to do.
Here is my code:
public void getChopped(Tree tree)
{GameObject meter = Addressables.Instantiate("AxeMeter", position: transform.position + new Vector3(1.5f, 1, 0), rotation: transform.rotation).Result;
meter.GetComponent<AxeMeterManager>().tree = tree;}
Firstly, using this Addressables.Instantiate method tells me it is obsolete. I don’t know if that’s the problem, and if it is, I don’t know how else to do this.
The AxeMeter appears in the scene just fine, but meter returns a null reference when I try to assign tree, or even try Debug.Log. This works fine when I don’t use Addressables. I’ve also tried to use GameObject.Find to no avail. I thought maybe it was taking a while for the meter to instantiate so I put in a loop to continue while meter==null and the game just froze.
Edit: Just learned something new and weird: If I instantiate and then destroy the object and then reinstantiate it, it works fine, just the first time doesn’t work. What gives?