I am trying to activate lights everytime mu bullets hit my enemy

Heyy Everyone i am facing some issues with the point light, what i am trying to do is activating my point light every time my enemy got hit and create an good looking effects and i am trying to do that in c# as an gameobject, i am taking an gameobject refrence and "setActive" it to true but it's not working i tried debugging using messages and it everything was working fine but the light gameobject was not getting activated and idk why.

Thanks for your help.

what is your code to activate the light?

private void Bleeding()
{
if (arrowThatHitMe != null)
{
Debug.Log("Arrow component has been found");
Bullets bullet = arrowThatHitMe.GetComponent();
if (bullet != null)
{
isbleeding = true;
Debug.Log("Enemy bleeding effect is active");
bleedinglighteffect.SetActive(true);
}
}
}

so depends where the heck you call that from, but if you're getting the debug logs, you must be calling it from somewhere, but are there any errors? cos if you get the debugs and not the light it implies bleedinglighteffect is null. but i would throw a nullreferenceexception


Nahh there's no errors and it's not null also i have assigned the bleeding Effect prefab in the inspector but only thing that's different is there's animation on the light but i don't think that's matter as the whole gameobject itself is not getting activated

"whole game object itself"? are you trying to activate a child of a disabled object?

i cant really tell based on what you've said so just get back to me when you have the time: your light is actually in the scene/on the game object right. if you're putting in a prefab of the light and not an actual light game object, you should use Instantiate(). Other than that, what bugfinders said is also possible, if you try to activate a child while its parent is still inactive, your child wont activate either


Nahh the child object is activate all the time, I am trying to active the parent object


yeah I didn't tried Instantiate() let me try and get back to you