Quantcast
Channel: Questions in topic: "namespace"
Viewing all articles
Browse latest Browse all 398

Need help calling a function from another script that is inside a namespace.

$
0
0
I have a function that is inside of a namespace, however when one of my normal scripts runs it there is a null reference void. Do I need to also include the parameter present in the first script into the one trying to run the function? If so, how would you do that. This is the script that is doing the calling. using System.Collections; using System.Collections.Generic; using System.IO; using System; using UnityEngine; using UnityEngine.SceneManagement; using Dylan.Scoreboards; public class boating : MonoBehaviour { public Playercontroller playerscript; public GameObject Word; public Timer Timers; public double Timelv3; public ScoreboardEntryData savescore; public test lv1Time; public Coast lv2Time; public double tempscore; public Scoreboard SB; public GameObject scoreboardHD; // Start is called before the first frame update void Start() { //playerscript = GameObject.FindGameObjectWithTag("Player").GetComponent(); } // Update is called once per frame private void OnTriggerEnter(Collider other) { playerscript.count = 8; Word.SetActive(false); SceneManager.LoadScene(sceneName: "Leaderboard"); Timelv3 = Timers.timer * 100; tempscore = Timelv3; Debug.Log(tempscore); savescore.entryScore = tempscore; Debug.Log(savescore.entryScore); SB.AddEntry(savescore); This is the original: using System.IO; using UnityEngine; namespace Dylan.Scoreboards { public class Scoreboard : MonoBehaviour { [SerializeField] private int maxScoreboardEntries = 10; [SerializeField] private Transform highscoresHolderTransform = null; [SerializeField] private GameObject scoreboardEntryObject = null; [Header("Test")] [SerializeField] ScoreboardEntryData testEntrydata = new ScoreboardEntryData(); private string SavePath => $"{Application.persistentDataPath}/highscores.json"; private void Start() { ScoreboardSaveData savedScores=GetSavedScores(); UpdateUI(savedScores); SaveScores(savedScores); } [ContextMenu("Add Test Entry")] public void AddTestEntry() { AddEntry(testEntrydata); } public void AddEntry( ScoreboardEntryData scoreboardEntryData) There is more to it but that the issue.

Viewing all articles
Browse latest Browse all 398

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>