Put a GameObject in the script's inspector when the script belongs to a prefab
hey,
I'm making a script for a prefab, this script has a public GameObject but the problem is that the script belongs to a prefab which will be add in the scene during the game.
I can't manage to add the public GameObject in the inspector because the GameObject is in the scene. So I made a prefab of this GameObject but the script doesn't recognise the GameObject in the scene...
Do you guys have any idea ? Tell me if you didn't understood my problem.
Answer by Fluflu420 · Jun 25, 2020 at 06:40 PM
Ok I found a solution, instead of Initiating the prefabs from a folder I put the prefab in the scene (in a dead zone) and just copy them with Initiate.
Your answer
Follow this Question
Related Questions
Scrpits component disappears when I enter playmode 0 Answers
[Solved]Weird Time.timeScale behavior 3 Answers
Having trouble moving a GameObject to another scene and Transform it to a different position 0 Answers
I cannot drag the animations into inspector please help [code snippet included] [C#] 0 Answers
How to instantiate a game object every time when space key is pressed 2 Answers