#Prefab Issue

1 messages · Page 1 of 1 (latest)

cedar comet
#

Test

half summit
#

i'm here lul

#

what are you trying to do when spawn that gameobject into the prefab

cedar comet
#

Here I'll explain how the tool works

half summit
#

in scene view

cedar comet
#

Basically I'm trying to spawn in some themed prefabs into the scene when I click this button in the inspector

#

For quick ability to change the theme of my scene

#

But all of the prefabs I'm spawning in through this editor script aren't blue

#

And any changes I make aren't detected by PrefabUtility.RecordObject

#

So I can't apply them to the prefab or whatever I'm meant to do

#

Changes I make to the original prefab are also not being set in my object in the scene

#

Ok here I think I explained that confusingly

half summit
#

oh wait me a min

#

i test this out

cedar comet
#

This is two problems, the first second one was easy to solve, but the first issue is persistent

half summit
#

so

#

you spawn GameObject via button

cedar comet
#

Yep

half summit
#

but it's not prefab?

cedar comet
#

Yeah

half summit
#

but the original you referencing is prefab?

cedar comet
#

I'm spawning a prefab but after it spawns it's no longer a prefab

#

yes

#

Ah I think I figured it out

#

I have to use PrefabUtility.InstantiatePrefab(GameObject), not Instantiate(), right?

half summit
#

yep

#

i just found the thread to it

cedar comet
#

Is there any way I'd be able to do that inside of my class?

#

Because as it currently stands my editor script tells my other script to instantiate

half summit
#

idk, classes init at runtime and have it own method

#

idk if it work just by wrap spawner in class

cedar comet
#

I think I'm probably structuring my code really badly since I'm new to editor scripting, but here

#

What I'm trying to do is make this an editor script, but also able to work at runtime, which is why I have this second script

#

Which is the one that runs both during editor and runtime

#

I should probably restructure it so that I can just spawn in the decorations in the editor and scrap the runtime section, since it feels unnecessary

#

I think I can probably take it from here tbh

#

Thank you for your help and suggestions

half summit
#

yeah just try and error

#

i'm help jack shit :v you do it all by yourself

cedar comet
#

Editor scripts are tough for me, lots of trial and error lol

cedar comet
#

So thanks for listening

half summit
#

np

#

help people help me so glad to hear that

cedar comet
#

😄

#

I might use this chat to talk through some other issues I have as I make this an editor window

#

So be prepared lol

half summit
#

ofc

cedar comet
#

Do you know how I can make a field for GameObjects in a custom Editor Window?

half summit
#

like slot to put in the gameobject?

cedar comet
#

Yeah

#

But as a field for an editor

#

It says I need a SerializedProperty

half summit
cedar comet
#

ObjectField is deprecated though, is there any newer way?