Hi, i wrote scripts to add UI buttons to my experience but when i preview i don’t see them, i think i saw somewhere that i had to attach them to an in game object but im unsure how to do that. I thought i could just drag and drop them onto an empty object to attach but it doesn’t seem to work. Any help would be wonderful thank you!
Hi!
I recommend reading the getting started guide here.
The scripts you’re writing are components that should be attached to entities before they do anything. Create an empty entity from the + button in the heirarchy and add your custom component to it from the properties menu.
Thanks just checked out the guide. Is there a specific line of code i need to add to my scripts to give them an EID? I have an empti entity in my scene but when i click “add component” I can’t find any of my scripts in the list available.
Components don’t have an eid
, eid
stands for Entity ID which is exclusive to entities. Additionally, You can also get the current entity from a component by doing component.eid
.
Ok fixed it. The reason i couldn’t find my scripts in the component list was because i needed to create “New Component File” instead of “Empty file”. Hope this helps someone else!
This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.