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 unity_0D01B6DF5482F8E52C3D · May 23, 2021 at 06:46 PM · javascriptwebglsendmessage

Unity WebGL UnityInstance.SendMessage Error: SendMessage: object Object1 does not have receiver for function moveObject

I have a built WebGL Unity game using Unity 2020.3.8f1 and I have modified the script on the index.html template to look like this: I only changed one line: unityInstance.SendMessage("Object1", "moveObject");

 script.onload = () => {
   createUnityInstance(canvas, config, (progress) => {
     progressBarFull.style.width = 100 * progress + "%";
   }).then((unityInstance) => {
     loadingBar.style.display = "none";
     unityInstance.SendMessage("Object1", "moveObject");
     fullscreenButton.onclick = () => {
       unityInstance.SetFullscreen(1);
     };
   }).catch((message) => {
     alert(message);
   });
 };

When the line gets called, it just returns with an error:

 SendMessage: object Object1 does not have receiver for function moveObject!

I did check to make sure that Object1 does have a moveObject function which does not have any parameters. It may help to mention that the Unity Game Object, Object1, has 2 scripts attached and I am not sure if the sendmessage function does not know where to get the function from. Is there away to also define which script you want to call the function of? ,I have a built WebGL game in which I am editing the index.html template and modified only this part and added unityInstance.SendMessage("Object1", "moveObject");:

   script.onload = () => {
     createUnityInstance(canvas, config, (progress) => {
       progressBarFull.style.width = 100 * progress + "%";
     }).then((unityInstance) => {
       loadingBar.style.display = "none";
       unityInstance.SendMessage("Object1", "moveObject");
       fullscreenButton.onclick = () => {
         unityInstance.SetFullscreen(1);
       };
     }).catch((message) => {
       alert(message);
     });
   };

When the function gets called, it just prints an error in the console:

 SendMessage: object Object1 does not have receiver for function moveObject!

One thing to mention is that Object1 has 2 scripts "attached" and I am not sure if the sendMessage does not know which of the two functions to call the function in. I made sure that Object1 does in fact include the moveObject function which doesn't have any parameters.

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 djexstas9 · Jun 02, 2021 at 08:21 PM

Seems game object is found but it doesn't contain script which should contain 'moveObject' method. I don't have much exp working with send messages but if game object not found it will say something like "object not found". Double-check method name, it's case sensitive, try changing access modifier to public if it's not. try waiting for a scene load + 1frame, check what will happen if you mark this object as DontDestroyOnLoad, try moving object to root of scene if it's not here. Really dunno.

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

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

172 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How can I send russian symbols from JS to Unity WebGL 0 Answers

Unity WebGL UnityInstance.SendMessage Error: SendMessage: object Object1 does not have receiver for function moveObject 0 Answers

Unity Button as HTML Button 1 Answer

WebGL builds: decipher jsStackTrace errors with symbol map? 1 Answer

Can't get WebGL to Interact with browser scripting 0 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