- Home /
What happen when you use interop sendmessage but have multiple gameobject with same name?
I don't know what will happen and I wish I could avoid it
Well, why unity sendMessage cannot use instanceID instead of name
Is that really apply to interop send$$anonymous$$essage? It is difference function though
Answer by Bunny83 · Apr 30, 2017 at 10:11 AM
InstanceIDs are not guaranteed to be the same between build. They are only used for internal object management. What happens when you send a message to Unity having multiple gameobject with the same name, is that Unity will simply pick the first one it finds.
You said you wish you could avoid it. Well the answer is you have to avoid it. interop communication should be handled by a single object / class in your scene. That class must have a unique name. Any other needs you might have can be handled by this single class.
I was expect that I could call native javascript from C# to execute some async code then send result back to target object. If there are Send$$anonymous$$essage by InstanceID I could send that ID to JavaScript to call Send$$anonymous$$essage
I don't expect that InstanceID would be the same between build but it should be the same in each times the scene was created. What I need is send$$anonymous$$essage dynamically
Thanks for clarifying the unity's behaviour
Your answer
Follow this Question
Related Questions
Send Message not working (editor?) 2 Answers
How do I send a variable (after calculation) as the final variable to another game object 1 Answer
How to Zoom and Orbit the camera around an origin for mobile 0 Answers
Player keeps flying up 0 Answers
How to make a button fixed its position on a gameobject model ? 1 Answer