• 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 Aug 01, 2016 at 01:44 AM by HomerDalors for the following reason:

The question is answered, right answer was accepted

avatar image
1
Question by HomerDalors · Jul 01, 2012 at 12:18 AM · bce0023essentials

[Unity 3.x Essentials, chap 02] BCE0023: No appropriate version of 'UnityEngine.Object.Instantiate'

hello everyone, i'm following the Book Unity 3.x GD Essentials (btw a great book) but i'm pretty stuck in the end of chapter 02 (and it's just the beginning xD) the goal is to create an instance of Prefab Bullet to shoot on a Wall. i did the scripting, re-read myself more than two times, compared with the step by step. but still getting an Error:

Assets/Shooter.js(13,55): BCE0023: No appropriate version of 'UnityEngine.Object.Instantiate' for the argument list '(UnityEngine.Rigidbody, UnityEngine.Vector3, UnityEngine.Vector3)' was found.

Here's the code done (attached to the camera):

 var bullet        : Rigidbody;
 var power         : float = 1500;
 var moveSpeed    : float = 5;
 
 function Update () {
     var h : float = Input.GetAxis("Horizontal") * Time.deltaTime * moveSpeed;
     var v : float = Input.GetAxis("Vertical") * Time.deltaTime * moveSpeed;
     
     transform.Translate(h, v, 0);
     
     if (Input.GetButtonUp("Fire1"))
     {
         var instance : Rigidbody = Instantiate(bullet, transform.position, transform.position);
         var fwd : Vector3 = transform.TransformDirection(Vector3.forward);
         instance.AddForce(fwd * power);
     }
 }

i hope someone can help here, Thanks in Advance !!

Comment
Add comment
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

1 Reply

  • Sort: 
avatar image
2
Best Answer

Answer by Graham-Dunnett · Jul 01, 2012 at 12:25 AM

Go to:

http://docs.unity3d.com/Documentation/ScriptReference/index.html

T$$anonymous$$s is the documentation page for Unity script. Search for "Instantiate" in the box top left. T$$anonymous$$s will show you all Unity APIs that have the word Instantiate in them. You're doing t$$anonymous$$s because the error message contains the word Instantiate, and tells you that line 13 of your code is the problem. (And I guess your line 13 is the one that called Instantiate.)

In the list that appears, select the top one, and you'll end up here:

http://docs.unity3d.com/Documentation/ScriptReference/Object.Instantiate.html

T$$anonymous$$s is the documentation for the Instantiate function. At the top of the page you'll see:

static function Instantiate (original : Object, position : Vector3, rotation : Quaternion) : Object

T$$anonymous$$s tells you that the Instantiate function takes 3 arguments, the last of w$$anonymous$$ch is a Quaternion. In your code you have passed in Transform.position as the last argument. The compiler is telling you that t$$anonymous$$s is bad. Change your script to make the last argument Transform.rotation and you'll be golden.

Note: I have tried to tell you how you can help yourself, w$$anonymous$$ch I t$$anonymous$$nk is more valuable that answering your question directly.

Comment
Add comment · Show 1 · 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 HomerDalors · Jul 01, 2012 at 12:28 AM -1
Share

Oww Gosh, i was sure i put rotation in the last argument, my eyes fooled me. Thannnnnks

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Can I read the UnityEngine Library? 2 Answers

sound on button press error + its firing when space is pressed 1 Answer

Error BCE0023 when using script for main menu 1 Answer

Can anyone link to / explain Unity's game loop? 1 Answer

Tooltip with GUI.TextField 2 Answers


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