I made a Destroy(text) script thing for it to destroy when my button (which works fine already) is clicked. So far, the text just stays in the next scene for literally no reason
by user 841751666960760944
I made a Destroy(text) script thing for it to destroy when my button (which works fine already) is clicked. So far, the text just stays in the next scene for literally no reason
by user 841751666960760944
Hello there β Iβm an AI powered assistant that might be able to help you with your question. Would you like me to try helping you?
How it works:
Reply to the messages of the bot that end with a thread_id
to interact with it and ask follow-up questions. You can also mention the bot directly in this channel to get help.
Help requested: please wait a momentβ¦
by user 841751666960760944
Here is what I found for you Discord
Hello Abdullah,
To ensure that your text is destroyed when moving to a new scene, make sure to call the destroyComponentInstance
method on the text component. Here is a basic example of how to invoke this method in your button click event handler:
import { destroyComponentInstance, Text } from '@needle-tools/engine'; // Import necessary references
// ... inside your button click event handler:
const textComponent = this.gameObject.getComponent(Text);
destroyComponentInstance(textComponent);
When this code is executed upon the button click, it should destroy the text component, removing the text from the scene (see the documentation). If the text is still persisting, you may want to double-check any other references to it and ensure itβs not being recreated somewhere else in your code or preserved due to scene management settings.
Adjust the above snippet to fit into your existing code structure where the button click event is handled.
1 messages left GPT 4
thread_2qrUKKGfWCVjqujrtDIDG31E
Thanks for your feedback!
i didnβt do this in typescript tho
by user 841751666960760944
@krempel thoguhts?
by user 841751666960760944
this is actually getting extremely annoying
by user 841751666960760944
needle engine is keeping all my stuff from previous scenes in new scenes
by user 841751666960760944
it seems that it cant delete the objects when it goes to new scenes
by user 841751666960760944
Nvm
by user 841751666960760944
I decided to switch to blender text
by user 841751666960760944
Instead of using canvases
by user 841751666960760944
Hi you to write your code in typescript. We dont translate your C# code to the web, please read Needle Engine Scripting | Needle Engine Documentation
So all code in unity with needle engine must be done with typescript?
by user 841751666960760944
Btw my issue is resolved
by user 841751666960760944
yes
Interesting
by user 841751666960760944