Script Reference Help

Hello

I have an object “AchievementManager” with “AchievementManager” Script and a DontDestroyOnLoad Script from a previous Scene that i need to reference in my current scene.

Here is my code

using UnityEngine;
using System.Collections;

public class HealthColidePlayer : MonoBehaviour {
	
	GameObject AchievementManager1;
	GameObject AchievementManager2;
	
	
	void Start () {
		AchievementManager1 = GameObject.Find("AchievementManager");
        AchievementManager2 = AchievementManager1.GetComponent<AchievementManager>();
	}
	
	
void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "Player")
        {
 		AchievementManager2.AddProgressToAchievement("Amped Up", 1.0f);
		//AchievementManager2.AddProgressToAchievement("Buzzing", 1.0f);
		//AchievementManager2.AddProgressToAchievement("AllSheHasGot", 1.0f);
        }

    }

}

Please someone explain to me the right way of doing it the right way.

P.S. I know this kind of question has been answered many time, but the answers dont seem to be helping.

Thanks

If I understood your question then you should change:

GameObject AchievementManager2;

with this:

AchievementManager AchievementManager2;

Also, be careful with DontDestroyOnLoad because you might end up with multiple similar objects that might interfere with your logics.