Adding scripts to objects

Hello!
How are you?

I just added a cube to my scene and I am trying to make it spin but it is not. I made the same thing before and it worked normally.

here are my screenshots did I do something wrong?


Original Post on Discord

by user 883276031048441917

Hello there – we have an experimental AI bot :robot: that might be able to help you with your question. Would you like to try this out?

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…

Hello Aya Ali,

I’m here to assist you with technical questions. To help you with the spinning cube issue, I would need to see the relevant code you’ve used to create and attempt to spin the cube.

Please share the code snippet where you’re setting up the cube and trying to apply the rotation logic. Just the screenshots won’t be sufficient for me to diagnose the issue—you can copy and paste the code here or describe in detail what methods or properties you are using to spin the cube.

Remember that when working with rotation in Needle Engine, you typically would modify the rotation properties of the object3D component within the update lifecycle method of a component attached to that cube. If you can provide the code, I can give you more specific advice.

1 messages left GPT 4
thread_0uXHAosgEr381dyrP8m7kRaB
Thanks for your feedback!

Have you added the component to the cube and do you get your log from start() in the browser console?

yeah, I watched this video https://www.youtube.com/watch?v=uf5UK0bLHlY&t=82s and did the same thing

by user 883276031048441917

No, I have Nothing in the console

by user 883276031048441917

Can you show a screenshot of the selected cube in your Unity scene where the inspector is also visible?

And also please in the browser

  • open the dev console
  • reload the page
  • send a screenshot of the console

by user 883276031048441917

by user 883276031048441917

Is the script actually on the cube? Not visible on the screenshot

by user 883276031048441917

It is not

by user 883276031048441917

That’s what I meant here. If you want that script to do something with that cube, add it to the cube

How to do that I mean I added it here

by user 883276031048441917

Scripts are just pieces of code. They need to be added to objects to do something with those objects.

  1. select the cube in the scene
  2. in the inspector, scroll down and click Add Component
  3. find your Rotate component and add that

If you have multiple objects that you want to rotate them each of them would have the „ Rotate“ script attached with its own settings (for example different rotate speeds)

wooho it is working

by user 883276031048441917

thank you

by user 883276031048441917