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 /
avatar image
0
Question by Jason 12 · Dec 12, 2010 at 01:33 AM · javascripterrorreferencestaticbce0020

An instance of type 'TurretControl' is required to access non static member 'Shoot'.

I'm fairly new to Unity 3D and game programming (high school class). I tried to "make" a game outside of the classroom...and it isn't WORKING If you haven't seen the TornadoTwin tutorials then just know that there are turrets and a worm made out of 3 sphere game objects. Both shoot a fireBall.

After the last turret is destroyed (for now there is only 1) I want it to go to the next level. When I added the part that said to go to the next level and destroyed the turret Destroy(gameObject [the turret]) stopped working and the above error came up. I got rid of this component as a result. Since I got rid of that the turret continues to shoot before the new level loads. I want to stop that function which is in a different script(Turret Control) or disable/remove the script entirely at this point.

How should I go about fixing this? Anything with // was gotten rid of due to the error I stated and this error as well:No appropriate version of 'UnityEngine.Object.Destroy' for the argument list '(function(Object): void)' was found.

Turret Collision Script or script reffering to other script:

var fireSound : AudioClip; var script: TurretControl;

function OnTriggerEnter( hit : Collider) { if(hit.gameObject.tag == "wormProjectile") { Destroy(hit.gameObject); var exp = Instantiate(explosion, gameObject.transform.position, Quaternion.identity); //Destroy(gameObject); //script = GetComponent(TurretControl.Shoot); // Destroy(script.Shoot) yield WaitForSeconds (4); Application.LoadLevel("2Scene"); } }

//function Update () //{ //if(GetComponent(TurretControl)) //{ // Destroy (GetComponent(TurretControl.Shoot ())); //} //}

Reffered script or TurretControl Script:

function Shoot(seconds) { if(seconds!=savedTime)

    {    

var bullet = Instantiate(bulletPrefab,transform.Find("spawnPoint1").transform.position,Quaternion.identity); bullet.gameObject.tag = "enemyProjectile"; bullet.rigidbody.AddForce(transform.forward * 1000); savedTime = seconds;

   }  

}

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

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Ahmer · Dec 12, 2010 at 07:06 AM

I have seen the TT's tutorial on worminator... here's my suggestion to you...

  1. Create an Empty GameObject (_GameManager)

  2. Create a manager Script, responsible for changing level and managing health etc.

  3. attach a line of code in your turret that every time its destroyed a Global variable such as countTurret -= 1 in your _GameManager script.

  4. When the variable countTurret = 0 then Application.LoadLevel(NextLevel);

I hope that gave u an idea...

Comment
Add comment · Show 3 · 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 Jason 12 · Dec 12, 2010 at 09:12 AM 0
Share

That sounds like a good idea. I'll try it.Unfortunately I can't play my game/load my scene now b/c this error came up: Invalid editor window UnityEditor.GameView UnityEditor.EditorApplication:Internal_PlaymodeStateChanged(). I'll use your suggestion as a base and put it into the scene for when I fix this new problem. Again, thanks a lot! Really appreciate it!

avatar image Jason 12 · Dec 12, 2010 at 09:24 AM 0
Share

$$anonymous$$ind taking a look at my other question too? Question: Unity suddenly stopped working when I pressed play/the problem I stated in the above comment. Thanks again again.

avatar image IMTRIGGERHAPPY9 · Aug 04, 2011 at 07:36 PM 0
Share

that was a great idea i actually never thought of doing something like that thanks for the input!

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.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Change gameobject sprite with button 1 Answer

what's wrong with this?? 2 Answers

Cannot use Static var/ Unknown Idientifier 1 Answer

Invalid IL code error when calling static function 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