And welcome back to Part 3.
We're now going to add a little character that's going to pop up in the augmented experience to celebrate
getting a word right.
So if you go to the resources attached to this lecture they'll be a package called class.
I want you to drag and drop that into assets.
Now Clay will have to be instantiated when the wood is correct.
So we need to pass her prefab to our spelling control.
So let's get back into the code.
We're going to go up to the top and include these as more public variables.
I've got to in this case sorry got reward is not public just Clary's the reward is needed because we're
going to instantiate clear when the word is found.
Correct.
The first time remember as it keeps checking and finding the Marcuse it's going to possibly instantiate
claim more than once and we don't want that.
So therefore we're just going to have a quick bhool to check if she exists and then not do that again.
All right so now we can go down to where we've counted how many correct we've got.
And add in as code for instantiation in here.
So instead of this debug correct let's just put that in like that.
And we also need to check for and we've not got rewards so when reward is fall got reward is false it'll
allow us in here.
It then gets to church after Clear is instantiated and therefore it won't run this again.
Now you'll see here that you need to figure out where you want to put Klahr in the experience so what
I've done is I'm just putting clay up relative to the first Mokka in the sit which in the case of card
would be the C position and then making sure I sit the parent to that particular market because she
becomes an augmenting character that has to be a child underneath that trackable so that she will disappear
when we lose sight of the Mocca.
All right so now you've got that just say that and we'll go back into unity click on your spelling control
the drag and drop.
Claire up onto that position now if you're wondering why Claire and the icon for that in the assets
looks like a big fat plane.
It is.
So the clay model is a celebrating character but it also has the shadow plane on there for you to save
you doing that.
Right.
So it's time to try it out.
So play
now still got my bad spelling from before so I'll have to fix that.
And as soon as we get through them correct we get a little dancing character who is going to celebrate
our victory of the spelling
and the shadows working.
Now if we lose that you'll see that she goes away.
However if we try to get her up again because we've already got rewards set to true or it's not going
to happen so we just need to tweak the code a little.
So back in the code let's just go down to where we're returning if this in chick spelling.
If we're turning where we don't have the correct word we can replace this and just inside with this
return statement so some squiggly brackets put in.
Got reward and set it back to full so that when it does lose a marker or all of the mark because it's
just going to reset that.
And that will fix the problem with Clay on the is showing up once.
Let's go back here and press play
and lose her
didn't lose that.
There we go.
OK so now is picking it up and bringing her back so that now if you change the word and you want to
get the person to spell a different word then you still going to get her back next time.
All right.
So we've got the bare bones for a spelling app now and you might want to extend this for the words.
So as a challenge I'm going to ask you to give it a go where we can now change the word that we need
to spell.
So try and build that functionality in.
And at the same time you might want to show a picture some way on the user interface of what you're
trying to spell or to say that would otherwise the user is going to have no idea.
Now there'll be many ways you can achieve this of course.
And when I come back in the next video I'll go through just one of those ways that you can quickly poulet
together to get that sort of functionality of a more complete spelling challenge augmented reality experience.