#boss trouble
1 messages · Page 1 of 1 (latest)
so i have a system.action that says the boss died
i guess that's an event
i know that
Were you able to properly reference the spawner after instantiating the boss?
right
wait
ok look
the boss prefab has a boss script
the WaveSpawnerTest has a script that spawns the boss
WaveSPawnerTest is the only spawner
there is no boss spawner
You're confusing stuff
if the level is 10 for example
You've only got a boss and a spawner
Your boss is referenced by your spawner so it can spawn the boss.
You need to reference the spawner with the boss so it can let the spawner know the boss is dead.
public WaveSpawnerTEST spawner; it is referanced
Right now your boss is referencing a prefab asset is spawner - not the spawner in scene.
but that's the WaveSpawnerTest prefab
Not the correct one.
i cannot reference an instance from the hierarchy to a prefab
Whatever it does to the prefab will not reflect on the spawner in scene.
It's just a reference to the prefab.
Cache the set the reference to the spawner like I've shown multiple times.
it wont let me tho :/
Sure it will. Show me what it shows you.
What type is boss prefab?
It should be type Boss
and i need it done by tomorrow at 5.30 pm
how do i check
Look where you've declared it
public Boss boss;
ok, thank you so much 🙂
i will work on it after as well
dont worry
do you mean that?
public Boss boss; ?
that line is on WaveSpawner
Why isn't it called boss in your Instantiate?
What is a bossPrefab?
It's got to be type Boss
to use Boss' methods
i can do
``public void SpawnBoss()
{
var bossInstace = Instantiate(bossPrefab, this.transform.position, this.transform.rotation);
boss.
}
then i get the methods
so boss.(what do i need here from the boss?)
Boss Instace;
Hint: Don't use the explicit variable name Instance unless it's referring to a Singleton, you'll confuse everyone. 😉
Look at the code I provided.
.
Do what I did here...
GameObject does not mean that is a prefab.. it's just saying to not let you use any methods or function from the prefab with your cached instance because you don't care or need them..
and the name is Instance
ohhhhhhhhhhhh
Boss bossPrefab
Spawner should be set now and the bool will work now
this is the instance
Well if you've cached the instance created by the prefab..
of game manager
Well.. remember that you're immediately setting it to false
So it's supposed to be false
this is the prefab
it cant do it
since
the instance of spawner says bossDead = false
the prefab of spawner says bossDead = true
Did you save?
When you instantiated the boss you set it's reference of spawner to that of the instance in scene.
it does update EndWave
It should represent the spawner in scene and not reflect on the prefab now
talk to me in code
since it will lead us to a loop
Changing the bool would occur on the instance now
I'm not going to do that, I'm on mobile and don't feel like coding everything.
ok
Show your spawn method
So the boss is correctly referencing the scene object.
its on the WaveSpawner in inpector
So you had an error
i didnt have errors