Hey gang.
Still learning, but getting there. Great software. Loving it.
I am having an issue with a light source, not appearing correctly.
I have the light set as a game object, and set to off initially.
When adding the game object using my hotspot script, it's not appearing at all. However if I click run in the script a few more times (obviously adding multiple instances of the object), I can eventually see the light bleed through my background.
Given this, is would appear the the game object is being added, but isn't being added to it's original position in the scene.
I have tried using Entered Value location to no avail. (ive also tried the other options in the dropdown, relative to player, object, etc. etc.)
I am sure I am missing something very simple.
Thanks in advance!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
If you set the Action's Position relative to field to Nothing, then the spawned object should take the same position as its original prefab.
However, spawning objects in a scene should generally be reserved for special-use cases. For something like a light, it's better to either control the light's intensity through animation, or rely on the Light Switch component.
If you re-enable your Light object in the Hierarchy, and attach a Light Switch component to it, uncheck Enable on start?, and it will automatically turn off when the scene begins.
You can then use the Object: Send message Action on it to pass the "Turn On" command when you're ready for it to show.
That's absolutely brilliant. I wasn't aware of the Light Switch component, this will make things much easier!
Works a charm.
Thank you again Chris.