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 /
This question was closed Nov 18, 2014 at 08:27 PM by Jeff-Kesselman for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by dyljaymac · Nov 18, 2014 at 08:27 PM · bce0023

Unity BCE0023 Error 'No appropriate version of 'UnityEngine.Transform.TransformDirection' for the argument list 'UnityEngine.Vector3, UnityEngine.RaycastHit)'was found.'

Hi I'm new to Unity and I'm making a game with combat as seen in the Brackeys series 'Create a 3D Survival Game' and I got this text

pragma strict

var TheDamage : int = 50; var Distance : float;

function Update () { if (Input.GetButtonDown("Fire!")) { var hit : RaycastHit; if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward, hit)) ) Distance = hit.distance; hit.transform.SendMessage("ApplyDamage", TheDamage, SendMessageOptions.DontRequireReceiver); } } Please help!

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 Jeff-Kesselman · Nov 18, 2014 at 07:48 PM 2
Share

Your fire axis really has an exclamation point on the end of its name???

avatar image MrSoad · Nov 18, 2014 at 07:51 PM 0
Share

I did wonder about that Jeff :D

avatar image dyljaymac · Nov 18, 2014 at 08:05 PM 0
Share

@$$anonymous$$rSoad Thanks! It worked! :D @Jeff $$anonymous$$esselman yeah, I think I was thinking of The I.T. Crowd at that point, so I think I put 'Fire!' ins$$anonymous$$d of 'Fire1'

1 Reply

  • Sort: 
avatar image
0

Answer by MrSoad · Nov 18, 2014 at 07:41 PM

You should format your code using the 101010 button.

After doing this I found some brackets in odd places, moved these and saved into my project with no errors. Weather it does exactly what you want it to do is a different matter and a different question...

Here is your code, reformatted and potentially fixed :

 #pragma strict
 
 var TheDamage : int = 50;
 var Distance : float;
 
 function Update() { 
 
     if (Input.GetButtonDown("Fire!")) { 
     
         var hit : RaycastHit;

         if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), hit)) {
             Distance = hit.distance; 
             hit.transform.SendMessage("ApplyDamage", TheDamage, SendMessageOptions.DontRequireReceiver);
         }
     }
 }
Comment
Add comment · 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

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Broken Script Help 1 Answer

BCE0023: No appropriate version of 'UnityEngine.Transform.LookAt' for the argument list '(UnityEngine.RaycastHit)' was found. 1 Answer

Help with a script to get an object to rotate slowly without your player moving 1 Answer

GUI.DrawTexture gives error 3 Answers

No appropriate version of 'UnityEngine.Object.Destroy' for the argument list '(System.Type)' was found 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