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 Pivot12 · Feb 11, 2013 at 02:33 AM · javascripterrorspawnerspawn points

"MissingMethodException: Method not found:" (Javascript)

I am trying to make a button activated spawn point using "Spawner - Free 1.7" and I am having trouble. I am modifying the code of a lift button already implemented in my scene.

 var Spawner : GameObject;
 var UseSound : AudioClip;  
 private var canUse : boolean = false;
 var waitTime : float; //Time till Spawner activate
 private var IRuzspiests : boolean = false;
 var SpawnerID : float;
 
 
 function Activate () {
     Spawner.EnableSpawner(int.SpawnerID);
     audio.PlayOneShot(UseSound, 1.0 / audio.volume);
 }
 
 function Deactivate (){
     Spawner.DisableSpawner(int.SpawnerID);
     audio.PlayOneShot(UseSound, 1.0 / audio.volume);
 }
 
 function ApplyDamage(){
     Action ();
 }
 
 function Action (){
     if (!canUse && !IRuzspiests){
         Activate();
         canUse = true;
         IRuzspiests = true;
         yield WaitForSeconds(waitTime);
         IRuzspiests = false;
     
     }else{
         if (canUse && !IRuzspiests){
         Deactivate();
         canUse = false;
         IRuzspiests = true;
         yield WaitForSeconds(waitTime);
         IRuzspiests = false;
         }
     }
 }

and here is the error

 MissingMethodException: Method not found: 'UnityEngine.GameObject.EnableSpawner'.
 Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.ProduceExtensionDispatcher ()
 Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.Create ()
 Boo.Lang.Runtime.RuntimeServices.DoCreateMethodDispatcher (System.Object target, System.Type targetType, System.String name, System.Object[] args)
 Boo.Lang.Runtime.RuntimeServices.CreateMethodDispatcher (System.Object target, System.String name, System.Object[] args)
 Boo.Lang.Runtime.RuntimeServices+<Invoke>c__AnonStorey14.<>m__7 ()
 Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
 Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
 Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object[] args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
 Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args)
 UnityScript.Lang.UnityRuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args, System.Type scriptBaseType)
 SpawnTriggerScript.Activate () (at Assets/Resources/OldScripts/LiftScripts/SpawnTriggerScript.js:11)
 SpawnTriggerScript+$Action$404+$.MoveNext () (at Assets/Resources/OldScripts/LiftScripts/SpawnTriggerScript.js:26)
 UnityEngine.GameObject:BroadcastMessage(String)
 FPSCcameraScript:Update() (at Assets/Resources/OldScripts/Vehicle scripts/FPSCcameraScript.js:18)
 

If anyone could tell me what I need to do to get this to work, it would be much appreciated.

the documentation on how to use the spawner is here: https://dl.dropbox.com/u/43996324/Unity/Spawner/html/functions.html

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
0

Answer by flaviusxvii · Feb 11, 2013 at 03:46 AM

Firstly, "Spawner" is the name of a Class in this "Spawner" package. So you don't want to name a variable "Spawner". In fact, you just shouldn't name your variables with upper case letters at the beginning, it's almost universally the norm to name TYPES with upper case letters to start.

Secondly, Your variable "Spawner" is of type GameObject. GameObject doesn't not have a method called EnableSpawner. If you want to treat "Spawner" like some other type, then the variable will need to be that type. You should change

 var Spawner : GameObject;

to

 var spawner : Spawner;

Then you can call spawner.EnableSpawner all day long.

Comment
Add comment · Show 6 · 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 Pivot12 · Feb 11, 2013 at 03:56 AM 0
Share

Thank you, it's obvious I am new to scripting, so thank you for helping.

Once i have var spawner : Spawner; layed out, how do i define 'Spawner' as a type? Unity says it is not valid.

avatar image flaviusxvii · Feb 11, 2013 at 05:24 AM 0
Share

The package from the Dropbox link you gave had a Spawner in it. Did you import that?

avatar image Pivot12 · Feb 11, 2013 at 10:42 PM 0
Share

I was trying but I couldn't get it to work

avatar image flaviusxvii · Feb 12, 2013 at 03:26 AM 0
Share

Well that's too bad. Your issues here are fundamental program$$anonymous$$g concepts. Often it's tempting to use something someone else has written, but it can be more confusing in the long run. Especially if that code is full of bad habits. Try programs that are simpler in scope and work your way into more complicated concepts.

avatar image Pivot12 · Feb 12, 2013 at 03:55 AM 0
Share

I actually figured out that I was calling in a namespace that was being compiled by unity AFTER the java was being compiled. Fixed the problem and everything works. Thank you for your help.

Show more comments

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

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

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

Setting Scroll View Width GUILayout 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

null exception reference on animation Unity 3.5+ 2 Answers

Trying to get enemy to aim at the player and shoot at it 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