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 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

This is the documentation page for Unity script. Search for "Instantiate" in the box top left. This will show you all Unity APIs that have the word Instantiate in them. You're doing this 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

This 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

This tells you that the Instantiate function takes 3 arguments, the last of which is a Quaternion. In your code you have passed in Transform.position as the last argument. The compiler is telling you that this 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, which I think 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

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

Unity 3 sealed class GameObject ? 3 Answers

Why is print() only in MonoBehaviour? 1 Answer

MD5 Implementation - Server Side High Score Problems 1 Answer

Problem with game resetting itself 0 Answers

Broken Script Help 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