Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

UnitySendMessage not working ?

Discussion in 'iOS and tvOS' started by geetoo, Jul 11, 2011.

  1. geetoo

    geetoo

    Joined:
    Apr 21, 2009
    Posts:
    42
    I can't get the UnitySendMessage function to work with Unity iPhone. Can anyone help me solving it ?

    For now, I just want to be able to send a message from the Xcode project to the Unity script. So I have "GuiTextGo" game object (with a GUIText component attached to it). It has a "WriteNewText(string param)" function. What it does is simply set the .text component to whatever the given param is.

    In my Xcode project, I call UnitySendMessage("GuiTextGo", "WriteNewText", "from Xcode"); but it doesn't do anything.
    I don't know exactly where I should make the call. I tried in several functions like "applicationDidFinishLaunching" and "applicationDidBecomeActive", I even tried in "accelerometer" to try to send it when moving the device, but nothing worked.

    Can someone tell me what I'm doing wrong ? Thanks a lot.
     
  2. geetoo

    geetoo

    Joined:
    Apr 21, 2009
    Posts:
    42
    Oops. My bad. I think it's OK.
    I just had an "if test" that would always failed so my function didn't execute properly... Sorry.