• 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
Question by Avanyx · Aug 28, 2010 at 05:47 PM · instantiatebce0023

Instantiate problem

var bullet = GameObject;

function Update () {

 if(Input.GetButtonUp("Jump")){
     var instance : GameObject = Instantiate(bullet, transform.position, transform.rotation);
 }

}

When I use that script I get the following error message:

Assets/launcher.js(6,56): BCE0023: No appropriate version of 'UnityEngine.Object.Instantiate' for the argument list '(System.Type, UnityEngine.Vector3, UnityEngine.Quaternion)' was found.

Any idea what I did wrong. In case you can't tell I'm new to both unity and scripting.

Comment

People who like this

0 Show 1
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 spinaljack · Aug 28, 2010 at 06:42 PM 0
Share

if the answer is correct then mark it with the check so that this site isn't loaded with more unanswered questions.

2 Replies

· Add your reply
  • Sort: 
avatar image

Answer by spinaljack · Aug 28, 2010 at 06:31 PM

change t$$anonymous$$s

var bullet = GameObject;

to t$$anonymous$$s

var bullet : GameObject;

Comment
GesterX
tylo
jtbentley
Justin Warner
Al-Anselmo
AMDAndrew
Nitrosocke

People who like this

7 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 Avanyx · Aug 28, 2010 at 06:33 PM 0
Share

Thanks it worked

avatar image

Answer by BlueBottom · Mar 31, 2013 at 10:35 AM

I get the same t$$anonymous$$ng, but my script looks like t$$anonymous$$s:

pragma strict

var myProjectile = GameObject; var reloadTime : float = 1f; var turnSpeed : float = 5f; var firePauseTime : float = .25f; var muzzleEffect = GameObject; var errorAmount : float = .001; var myTarget : Transform; var muzzlePositions : Transform[]; var turretBall : Transform;

private var nextFireTime : float; private var nextMoveTime : float; private var desiredRotation : Quaternion; private var aimError : float;

function Start () {

}

function Update () { if(myTarget) { if(Time.time >= nextMoveTime) { CalculateAimPosition(myTarget.position); turretBall.rotation = Quaternion.Lerp(turretBall.rotation, desiredRotation, Time.deltaTime*turnSpeed); } if(Time.time >= nextFireTime) { FireProjectile(); } } } function OnTriggerEnter(other : Collider) { if(other.gameObject.tag == "Enemy") { nextFireTime = Time.time+(reloadTime*0.5); myTarget = other.gameObject.transform; } } function OnTriggerExit(other : Collider) { if(other.gameObject.transform == myTarget) { myTarget = null; } } function CalculateAimPosition(targetPos : Vector3) { var aimPoint = Vector3(targetPos.x+aimError, targetPos.y+aimError,targetPos.z+aimError); desiredRotation = Quaternion.LookRotation(aimPoint); }

function CalculateAimError() { aimError = Random.Range(-errorAmount, errorAmount); }

function FireProjectile() { audio.Play(); nextFireTime = Time.time+reloadTime; nextMoveTime = Time.time+firePauseTime; CalculateAimError();

for(theMuzzlePos in muzzlePositions) { Instantiate (myProjectile, theMuzzlePos.position, theMuzzlePos.rotation); Instantiate (muzzleEffect, theMuzzlePos.position, theMuzzlePos.rotation); } }

can anyone help me with t$$anonymous$$s problem?

Comment

People who like this

0 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 whydoidoit · Mar 31, 2013 at 10:36 AM 0
Share

Don't post things which are not Solutions as answers - your problem is exactly the same - you are using = GameObject not : GameObject.

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.

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

2 People are following this question.

avatar image avatar image

Related Questions

Instantiating prefab at child (spawnlocations are arrays) 2 Answers

need help with instantiate'ing a Rigidbody 1 Answer

Checking if object intersects? 1 Answer

Instantiating an empty with a script attached 1 Answer

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