#boss trouble

1 messages · Page 1 of 1 (latest)

boreal notch
#

yo

#

so i have a system.action that says the boss died

#

i guess that's an event

#

i know that

untold walrus
#

Were you able to properly reference the spawner after instantiating the boss?

boreal notch
#

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

untold walrus
#

You're confusing stuff

boreal notch
#

if the level is 10 for example

untold walrus
#

You've only got a boss and a spawner

boreal notch
#

it calls SpawnBoss

#

inside WaveSpawner

untold walrus
#

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.

boreal notch
#

public WaveSpawnerTEST spawner; it is referanced

untold walrus
#

Right now your boss is referencing a prefab asset is spawner - not the spawner in scene.

boreal notch
#

but that's the WaveSpawnerTest prefab

untold walrus
boreal notch
#

i cannot reference an instance from the hierarchy to a prefab

untold walrus
#

Whatever it does to the prefab will not reflect on the spawner in scene.

#

It's just a reference to the prefab.

boreal notch
#

ok

#

so how do i reference the instance

untold walrus
#

Cache the set the reference to the spawner like I've shown multiple times.

boreal notch
#

it wont let me tho :/

untold walrus
#

Sure it will. Show me what it shows you.

boreal notch
#

ok

#

i need to turn in the game tomorrow

#

and i have no time

untold walrus
#

What type is boss prefab?

boreal notch
#

im going to work in an hour

#

untill 3 am

untold walrus
#

It should be type Boss

boreal notch
#

and i need it done by tomorrow at 5.30 pm

boreal notch
untold walrus
#

Look where you've declared it

boreal notch
#

public Boss boss;

#

ok, thank you so much 🙂

#

i will work on it after as well

#

dont worry

boreal notch
#

that line is on WaveSpawner

untold walrus
#

What is a bossPrefab?

#

It's got to be type Boss

#

to use Boss' methods

boreal notch
#

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?)

untold walrus
boreal notch
#

Boss Instace;

untold walrus
untold walrus
boreal notch
#

boss.spawner.this;

#

gives me an error

untold walrus
#

Look at the code I provided.

boreal notch
#

uhm

#

"GameObject does not contain a definition for spawner

untold walrus
boreal notch
#

im sorry if i dont understand you

#

:/

untold walrus
boreal notch
#

i cant do Boss;

#

it needs a name

untold walrus
#

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..

boreal notch
#

and the name is Instance

untold walrus
#

Dude remove GameObject

#

Stop fighting this

boreal notch
#

ohhhhhhhhhhhh

untold walrus
#

Boss bossPrefab

boreal notch
#

1 sec

#

okkkkkkkkkk

#

no error now

untold walrus
#

Spawner should be set now and the bool will work now

boreal notch
#

still no

#

Boss died

boreal notch
untold walrus
#

Well if you've cached the instance created by the prefab..

boreal notch
#

of game manager

untold walrus
#

Well.. remember that you're immediately setting it to false

#

So it's supposed to be false

boreal notch
#

this is the prefab

untold walrus
#

But look at the logs

#

You're just needing it to print boss is dead

boreal notch
#

it cant do it

#

since

#

the instance of spawner says bossDead = false

#

the prefab of spawner says bossDead = true

untold walrus
#

Did you save?

boreal notch
#

yes

#

the instance does not update Only bossDead

untold walrus
#

When you instantiated the boss you set it's reference of spawner to that of the instance in scene.

boreal notch
#

it does update EndWave

untold walrus
#

It should represent the spawner in scene and not reflect on the prefab now

boreal notch
#

since it will lead us to a loop

untold walrus
#

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.

boreal notch
#

ok

untold walrus
#

Show your spawn method

boreal notch
untold walrus
#

So the boss is correctly referencing the scene object.

boreal notch
#

i guess

#

what is that?

untold walrus
#

You can test this by calling boss.name before setting the bool to true

boreal notch
#

its on the WaveSpawner in inpector

untold walrus
#

So you had an error

boreal notch
#

i didnt have errors

untold walrus
#

Drag the boss prefab into it

#

It occurred when you changed the type as expected

#

Thought you fixed it on your own

boreal notch
#

it works 🙂

#

thank you so much for the patiance

boreal notch
#

@scenic vortex i'm 26 y/o, im taking a game developer course

#

and btw they were very impressed with what i've accomplished