Hi @WizardGameDev ,
I’m glad you were able to find a workaround to the issue.
I tried to reproduce the issue in my project, but wasn’t able to. I setup a simple script that creates tooltip triggers from a prefab, and it also destroys all the tooltip triggers under the gameobject it created them under.
Here’s a video of me creating and destroying TooltipTriggers from the buttons, and below is the script for the Add/Remove buttons.
https://www.youtube.com/watch?v=EoEh41qQGGU
public void AddTooltipFromPrefab()
{
// Load the button prefab from Resources.
GameObject buttonPrefab = Resources.Load<GameObject>("DynamicObjWithTooltip");
if (buttonPrefab != null)
{
// Assuming the prefab exists, instantiate the button and set its parent.
Instantiate(buttonPrefab, tooltipTriggerButtons.transform, false);
}
}
public void DeleteTooltipFromPrefab()
{
TooltipTrigger[] triggers = tooltipTriggerButtons.GetComponentsInChildren<TooltipTrigger>();
foreach (TooltipTrigger trigger in triggers)
{
Destroy(trigger.gameObject);
}
}
Since I can’t seem to get the error to happen on my end, I’m thinking there must be something more to it. Is there perhaps a Canvas on your prefabs, that might cause the tooltip container object to attach itself under that canvas, and then it’s getting deleted along with the prefab, or something like that? I’d probably need to see what all is included in the prefab, or know where the error is happening (the specific error and line number). Or if you could post the code you’re using to instantiate and destroy the prefabs, that might help.
Otherwise, please feel free to zip up your project and upload it to a cloud hosting service (like DropBox, Google Drive, OneDrive, etc) and send a link to modelsharkstudio@gmail.com, and I’ll take a look at it and see if I can figure out what’s going on. Or if there’s some other way you can think of that I can reproduce the issue on my end (in our demo scene, for instance) that would help.







