Invisible Prefab spawning at location of Player before being instantiated
I am working on a script for a simple 2D object(Bear) to chase the Player Character. The Player contains a script with a prefab it can spawn called CampFire. The Bear cannot continue chasing the Player when in a certain distance from the campfire, and shows a constant debug of that distance.
The issue is that the debug is showing a distance to a campfire before it is spawn, at the location that the Player Character spawned. The location does not change when the player moves, it is constantly at the location the player spawn. There is no CampFire prefab in the hierarchy anywhere, it is only spawned.
Answer by tormentoarmagedoom · Mar 03, 2020 at 02:39 PM
HEllo.
We are not magicians, without posting the code, is impossible to know what is happening,.
Another thing, Unity does not fail. If is printing the distance is because the code is doing that. Learn to DEBUG your code, to see when and why is doing that.
Bye.
Your answer
Follow this Question
Related Questions
Why do my first 50 instances of a prefab have the same properties? 1 Answer
Instantiated object not in right position 1 Answer
How to find the (original) Prefab of a GameObject? 2 Answers
Instantiated prefabs acting different than those dragged onto scene 0 Answers
Im having an issue when Instantiate Prefab with specific rotation 2 Answers