Access Dictionary on other Script on Object
Hi everybody,
I'm trying to have Script A access a dictionary in Script B on the same object. Reason for this is I wish to Prefab the object but swap Script B with different scripts containing Dictionaries.
The following code produces an error highlighting 'CharacterDialog' saying " 'UnityEngine.Component' does not contain a definition for 'CharacterDialog'."
public string dialogSource;
private Component dialogSourceComponent;
void Start () {
dialogSourceComponent = GetComponent(dialogSource) as Component;
currentDialog = dialogSourceComponent.CharacterDialog["Dialog1"];
}
I'm confused as to how I am supposed to:
Call the Script
Access the Dictionary
Your answer
Follow this Question
Related Questions
Need help to generate a random assortment of 4 buttons - C# 0 Answers
Dictionary creates copy, rather than references 1 Answer
Error with AI going to Waypoints,Issues with AI tracking waypoints 0 Answers
Script not working But in the tutorial it did work just like this 1 Answer
i want the wheel staring spin only if i click it on a button !!! (i have script) 0 Answers