This question was
closed Jul 26, 2020 at 03:50 AM by
CJCreeper for the following reason:
I figured it out
Question by
CJCreeper · Jul 26, 2020 at 02:07 AM ·
classescallingother script
Use another Class in a script with 'Using..'
So I am guessing that the using function is calling a built-in script from Unity. Could I use that to use Ints, Vars, and GameObjects from another script in that script?
Ex.
Script A
using UnityEngine;
using UnityEngine.SceneManagement;
public class UIFunctions : MonoBehaviour
{
public GameObject gameMenuDisplay;
public GameObject optionsMenuDisplay;
public GameObject helpMenuDisplay;
public void HelpMenuOpen()
{
helpMenuDisplay.SetActive(true);
gameMenuDisplay.SetActive(false);
}
public void OptionsMenuOpen()
{
optionsMenuDisplay.SetActive(true);
gameMenuDisplay.SetActive(false);
}
}
Script B
using UnityEngine;
//using <- Here call Script A
public class HelpDisplayScript : MonoBehaviour
{
public void HelpMenuClose()
{
gameMenuDisplay.SetActive(true);
helpMenuDisplay.SetActive(false);
}
}
I dont want to use it in the same script as I am going to put stuff in script A for the Menu and storing all the variables, and in script B it's going to be for the help menu ( a different one).
Comment
Follow this Question
Related Questions
call a class in another class 2 Answers
Managing In-Game Variables of Different Data Types 1 Answer
Array of scripts: How to access the scripts by name? 1 Answer
Class Structure for Many to Many relationship? 0 Answers
How would I be able to store a value that can be used later with a function that returns void? 1 Answer