Hey, I cant seem to find an answer to this anywhere and to me it looks like unity is just bugging out… Ive tried restarting Unity and it still happens, I’ll try restarting my computer now but figured I would toss this question out in the mean time…
I have this very simple piece of code here:
using UnityEngine;
using System.Collections.Generic;
public class recip : MonoBehaviour {
public GameObject playa;
public Recipes recips;
public List<Recipes> recipList;
// Use this for initialization
void Start () {
recips = playa.GetComponent<New_Movement> ().currentRecipe;
//recips = GameObject.Find("Player").GetComponent<New_Movement> ().currentRecipe;
}
// Update is called once per frame
void Update () {
}
}
The issue is… when this script is placed on a gameobject and THEN the game is ran, nothing happens, it does not properly set the variable ‘recip’ to what it should be…
HOWEVER if I run the game, and then place this script on a gameobject after the game is already running… it works fine, ‘recip’ is set as it should be…
*also note i’ve tried the method commented out here, as well as another method that is working on a different gameobject but is not working on this or any other gameobject…
Does anyone have any ideas why this might be happening?
Thanks in advance!