Hi there..
I want to SetActive a UI GameObject at Runtime. The Lines for that action are:
void OnTriggerEnter(){
if(InteractSymbol != null){
NGUITools.SetActive(InteractSymbol, true);
InteractSymbol.transform.FindChild("Label").GetComponent<UILabel>().text = cInput.GetText("Interact");
}
}
void OnTriggerExit(){
if(InteractSymbol != null){
NGUITools.SetActive(InteractSymbol, false);
}
}
Now on a Testplay, Unity gives me the following Error:
[spoiler]
Destroying GameObjects immediately
is not permitted during physics trigger
/contact, animation
event callbacks or OnValidate
. You must use Destroy instead
.UnityEngine.Object:DestroyImmediate(Object)
NGUITools:DestroyImmediate(Object) (at Assets/NGUI/Scripts/Internal/NGUITools.cs:1085)
UIDrawCall:ReleaseInactive() (at Assets/NGUI/Scripts/Internal/UIDrawCall.cs:839)
UIDrawCall:ReleaseAll() (at Assets/NGUI/Scripts/Internal/UIDrawCall.cs:827)
UIPanel:OnDisable() (at Assets/NGUI/Scripts/UI/UIPanel.cs:1014)
UnityEngine.GameObject:SetActive(Boolean)
NGUITools:SetActiveSelf(GameObject, Boolean) (at Assets/NGUI/Scripts/Internal/NGUITools.cs:1272)
[/spoiler]
The problem, as you can see at the Lines, is: I don´t destroy any object. I instantiated and Destroyed the Object, before i changed to SetActive - yes.. But i Changed it, saved it several times now.. But NGUI still thinks i´m destroying the Objects ._.
What´s wrong here?