Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by SoulsReaper · Nov 26, 2014 at 01:57 PM · assign3dtext

Can't Assign 3DText to the script

Hello guys , first of all please understand I'm still new to Unity and I know my question maybe a little obvious, I made a 3dtext named "Score_Text" which is suppose to get score +100 every time the cannon balls hits the target , The problem is I cant assign the 3dtext to the actual script, I checked my script uncountable times since 3 days and no use I tried everything that could be the problem, here is a screeshots for my problem with the script :

alt text

alt text

Thanks In Advanced for help.

question.png (227.0 kB)
question 3.png (242.4 kB)
Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image gjf · Nov 26, 2014 at 12:46 PM 0
Share

if you're posting a script, post the script contents and not a screenshot of it. if's easier to read and, where necessary, can be pasted into unity to help somebody help you. nobody is going to retype something from a screenshot.

a screenshot would be helpful to show the other components attached to the game object that your script is also attached to.

also, there's no need to put all your text in bold either, you might as well use ALL CAPS if you're attention seeking...

avatar image SoulsReaper · Nov 26, 2014 at 02:35 PM 0
Share

$$anonymous$$y Apologies I didn't mean attention seeking I just prefer bold writing because I feel more comfortable reading it ... I will Upload the whole project (1 mb) If you can help thanks in advanced :)

avatar image SoulsReaper · Nov 26, 2014 at 02:41 PM 0
Share

Sadly I couldn't upload my file I don't know why but it wont allow me ...

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Owen-Reynolds · Nov 27, 2014 at 12:36 AM

Don't use the pop-up to assign Inspector gameObjects. Instead drag your Score_Text into the Inspector slot.

The pop-up is really useful for things like Textures and Materials. But, it only looks at your Assets. In this case, it would only find created prefabs, since those are assets. It won't show you gameObjects in the scene.

In general, you can drag anything into an inspector slot (instead of using the pop-up.) Often you know where it is already, so dragging is just easier. The pop-up is good for when you know you have a "wood" texture, but can't remember where.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SoulsReaper · Nov 27, 2014 at 02:43 PM 0
Share

Thanks for replying to my question , the problem is even when I drag Score_text to inspector it wont be assigned to ball script ...

avatar image Owen-Reynolds · Nov 27, 2014 at 05:11 PM 0
Share

Is your 2nd picture correct? Are you using the ballScript in Assets? Ins$$anonymous$$d of that, a real gameObject should have ballScript on it, then select that gameObject.

"$$anonymous$$onobehavoiur" scripts are always meant to be used that way -- add them to a gameObject. Otherwise they aren't in the scene, and won't run. The only reason they even show slots for the script in Assets is for a rare shortcut using prefabs.

avatar image SoulsReaper · Nov 27, 2014 at 07:15 PM 0
Share

The ball is shooting correctly by another script called cannon , the only thing written in ball script is when it hits the target it shall gives +100 score .

avatar image Owen-Reynolds · Nov 27, 2014 at 09:11 PM 0
Share

So the ball is a prefab? Prefabs can't have links to non-prefabs (they aren't part of the scene, so can't know about anything in the scene.)

Can either use GameObject.Find, or have the cannon script assign the var, after the Instantiate.

avatar image SoulsReaper · Nov 27, 2014 at 10:48 PM 0
Share

Thanks so much for your help , I fixed my problem after 4 long days , thanks again :)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

assign wheel collider through script 1 Answer

Variable not Assigned 1 Answer

Changing the colour of a 3DText through script gives a weird error 0 Answers

How do I assign a script to a clone through another script? 1 Answer

How Unity assigns image effect shaders to their scripts automatically? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges