So I bought a gif player from OldMoat games and I wanted to be able to control which gifs play when from the comfort of my dialog editor. I wrote this script:
Lua variables match the names you've defined in your dialogue database except for certain special characters like spaces, as described in Important Note About Tables Indices. In Lua, characters such as spaces are replaced by underscores ( _ ).
Okay, I did like you suggested and found a spelling error in my Variables list in the process (sweet!).
But after running the Lua functions again, even from the Dialog System Trigger that starts the conversation, the character still seems totally oblivious to the commands.
Is something overriding them?
I'm sorry for taking so much of your time, but thank you. I don't think I could figure this out on my own.
Thank you so much for your help.
Oh! My stats!
Unity 2020.1.10f1
Adventure Creator 1.72.2
Dialogue System for Unity 2.2.12
1. Got rid of the GifManager() constructor method. You don't need to define a constructor for MonoBehaviour classes.
2. More importantly, I changed GetMethod("GifManager") to GetMethod("ShowGif") and the same for HideGif. The original code was accidentally trying to get a method named GifManager() instead of ShowGif(). Sorry, I should've caught those before. I blame it on Saturday morning before coffee.
Alright! Now we're getting somewhere!
Okay, the starting animation stops running, no new gifs show up, but animation resumes after the conversation ends. I need to figure out how to render images visible/invisible now. enable alone won't do the trick. That sounds like a Unity job, so Google probably knows something...
Thank you again, and I'll update as soon as I figure this out!
Thank you so much for your help.
Oh! My stats!
Unity 2020.1.10f1
Adventure Creator 1.72.2
Dialogue System for Unity 2.2.12
So the gifs are activating/deactivating when called, but only cheerful maya is ever drawn.
Do I really need to make every possible mistake before this project will let itself be done?
public void HideGif(double e)
{
Debug.Log("Hiding a gif: e = "+e);
Gif[(int)e].gameObject.SetActive(false); // Once inactive, I think that's all you need to do here.
}
public void ShowGif(double e)
{
Debug.Log("Showing a Gif: e ="+e);
Gif[(int)e].gameObject.SetActive(true);
Gif[(int)e].enabled = true;
Gif[(int)e].Play(); // Assuming there's a Play() method.
}
I think the problem is that using any gif player commands before all the gifs are loaded cause it to mess up. Yep, that's it! Now all I need to do is... the gif objects have just spontaneously deassigned their assets. I managed to reassign them, but now my trigger sprite looks like this:
thisisnew.png (201.02 KiB) Viewed 1600 times
And I can't trigger the conversation at all.
What would make the trigger act like that?
Thank you so much for your help.
Oh! My stats!
Unity 2020.1.10f1
Adventure Creator 1.72.2
Dialogue System for Unity 2.2.12