Page 2 of 2
Re: Demo Spawner Missing
Posted: Wed Jan 03, 2018 6:33 pm
by Gandoff
In your step two (assigning player to interact object), how could I do this via C#?
Re: Demo Spawner Missing
Posted: Wed Jan 03, 2018 6:36 pm
by Gandoff
Also select the blank element in the Dialogue For Rewards Section, then click the "+". This is a mistake in the prefab that's fixed in version 1.0.2.
What option do I select from the pop up menu once I have clicked the plus?
Re: Demo Spawner Missing
Posted: Wed Jan 03, 2018 7:28 pm
by Tony Li
Gandoff wrote: ↑Wed Jan 03, 2018 6:36 pm
Also select the blank element in the Dialogue For Rewards Section, then click the "+". This is a mistake in the prefab that's fixed in version 1.0.2.
What option do I select from the pop up menu once I have clicked the plus?
Oops, sorry, I meant "-". The intent is to remove the erroneous blank element.
Re: Demo Spawner Missing
Posted: Wed Jan 03, 2018 7:34 pm
by Tony Li
Gandoff wrote: ↑Wed Jan 03, 2018 6:33 pm
In your step two (assigning player to interact object), how could I do this via C#?
I'll explain how to set up the Targetable component's OnInteract() event below. But, since you're using C#, you may find it easier to simply call the C# method. If your C# script is on the quest giver, do something like this:
Code: Select all
var player = GameObject.FindWithTag("Player");
GetComponent<QuestGiver>().StartDialogue(player);
However, if you want to set up the Targetable component, try this:
Code: Select all
var targetable = GetComponent<Targetable>();
var questGiver = GetComponent<QuestGiver>();
var player = GameObject.FindWithTag("Player");
targetable.onInteract.AddListener(delegate { questGiver.StartDialogue(player); });
Re: Demo Spawner Missing
Posted: Wed Jan 03, 2018 7:39 pm
by Gandoff
Thank you very much. You have been very thorough and quick to respond. That makes for GREAT customer service!
That was just what I was looking for.
Re: Demo Spawner Missing
Posted: Wed Jan 03, 2018 7:46 pm
by Tony Li
My pleasure.
Full disclosure: I typed the second code block directly into the reply. I didn't test it. There might be typos. If it doesn't work right off the bat, you may need to fiddle with it. I'll give it a test now and fix my reply if necessary.
Edit: Okay, tested and corrected. Apologies for my laziness earlier.
One thing I should add: In version 1.0.1, the Player prefab isn't tagged "Player", so the code above won't find the player unless you set the tag.