#I checked and all of the gameobjects are
1 messages · Page 1 of 1 (latest)
Can you run me through your problem again? I'm trying to piece it together, but it got lost in all the messages haha
IM SORRY! i had to go eat
essentially, im trying to destroy block thats part a prefab, without breaking the actual prefab
more info is here
"soo could anyone help me with destroying just the instance of a prefab? currently im trying to destroy whatever object touches me. but it also destroys the actual prefab, not that induvidual instance
so if i ever want to summon the prefab again, its missing all of the parts i destroyed"
No problem at all!
Hmmmm
What is the role of this in the destroy method?
Is that how you work with prefab instances?
to get this script, and then the gameobject
yes but im obviously not very good with them
:)
holy crap that seemed so passive aggresive on a second read mb
Not very good with them yet
*yet
Let's see if we can figure it out
So I'm not seeing where the instance of the prefab is instantiated
wdym?
ohhh
no its in a seperate script
ill pull it up
big block of code but im not sure which parts are important to you
(yes there is lego terrain, yes this is a game jam)
oh nice
And I'm wondering if this means anything at all
It would make sense in something like JavaScript
well it only runs when destroying the threshold.
or chunk loader, whatever you want to call it
HOLD ON I GOT IT
Hmmm
What is this game object? I'm not sure what this script is attached to
its attached to the chunk loader
so if the player runs into an invisible super tall object, this runs
i could try
Let's see what it spits out
i put it in the projectile's script, should i put it in the chunk loader one too?
Wherever you're calling destroy
I'm also surprised it's not complaining about the recursion in the destroy method you define
Yeah
i have crappy code, and the cooldown hasnt been implemented for the bite yet so the log is just filled with the same log
might take a minute to fix at most tho
creating a new chunk loader makes it work fine
im wondering if its cloning itself instead of the prefab
is it possible to find objects that are only in your files, using code?
nvrmind thats a google question oops
when you walk into it it summons a random prefab from one of 3 arrays, at the end of each prefab or "chunk", theres always another chunk loader
so theoretically thats infinite generation
If a player collides with it, and the "game controller" is grassy, it does something
Oh I see
So lemme try to say it back to you to see if I understand
You've got a chunk of playable area
havent coded the other terrains yet but their the exact same
And when the player reaches the edge, you want to spawn another chunk where they went to
yes
And you want the same thing to happen if the player reaches the edge of that chunk too
if there's a way to find gameobjects through files then my problem is fixed
Ok I think we need to step back a little bit
OK
I think part of the problem is the chunks are managing part of the system that spawns other chunks
It's basically a house of cards
I think you need a separate thing that manages the spawning
I think that would work much better than what im doing actually
I think the chunks need to be decently removed from that process
i could also keep an offscreen instance of each terrarin prefab, and reference that to make sure i get the actual prefab instead of the wrong one, but that bring many more problems than your idea
sooo is that the fix? thank you so much for your help, like seriously. between homework and other stuff I haven't had the brainpower to fix this but you've been a lifesaver
:)
I think the chunks can fire an event or something when something enters the region of the chunk that triggers the spawning
Or maybe the main controller can simply manage the collision objects for where it knows it hasn't spawned chunks yet but might need to
I was currently doing that yeah
*am
Nice
well i finally have an excuse to play around with for loops