call ChangeActorName in C#?
Posted: Tue Oct 15, 2019 10:27 am
Hey, I have the ChangeActorName script Tony suggested to set actors' display names during dialogue (ie if someone introduces themselves). Can I call that in C# as well?
Specifically, let's say I have an external save system, and I store the 'state' of the various characters the player has met. Now I want to see if each of those characters was properly introduced, and set their display names on load if so. I have this snippet of code:
However it returns an error because the ChangeActorNameLua script is public, but not public static. I considered just making it public static, but it necessarily includes the OnEnable and OnDisable methods which would also need to be set to public static. Would that interfere with anything? Like if another script has an OnEnable as well? Is there a better way to do this altogether?
For reference, here's the ChangeActorName stuff.
Specifically, let's say I have an external save system, and I store the 'state' of the various characters the player has met. Now I want to see if each of those characters was properly introduced, and set their display names on load if so. I have this snippet of code:
Code: Select all
foreach (string charac in characters) { // iterate over characters we've met
if (characters[charac] != "encountered") { // if not just 'encountered', they are at least introduced
ChangeActorNameLua.ChangeActorName(charac, charac); // so set it to their real name
}
}
For reference, here's the ChangeActorName stuff.