• 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 t$$anonymous$$s text

pragma strict

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

function Update () { if (Input.GetButtonDown("Fire!")) { var $$anonymous$$t : RaycastHit; if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward, $$anonymous$$t)) ) Distance = $$anonymous$$t.distance; $$anonymous$$t.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

@MrSoad Thanks! It worked! :D @Jeff Kesselman yeah, I think I was thinking of The I.T. Crowd at that point, so I think I put 'Fire!' instead 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 t$$anonymous$$s 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 $$anonymous$$t : RaycastHit;

         if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), $$anonymous$$t)) {
             Distance = $$anonymous$$t.distance; 
             $$anonymous$$t.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

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

need help with instantiate'ing a Rigidbody 1 Answer

How "include" the Raycast?! 1 Answer

Raycasting with LayerMask gives me a bce0023 1 Answer

problem with Destroy Function!! 2 Answers

Instantiating an empty with a script attached 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