Search Unity

Webplayer unity.sendMessage - possibility to retrict access?

Discussion in 'Editor & General Support' started by venice, Sep 18, 2012.

  1. venice

    venice

    Joined:
    Oct 29, 2009
    Posts:
    3
    Hi there,

    I'm working with webplayer and have some communiction between webplayer and embedding website via unit.sendMessage(...). In my tests i found out, that you can call every function, if you just know object's and function's name. Is there a way to restrict access to objects/methods (e.g. via whitelist/blacklist, ...) ?

    Example:

    (embedded in Webplayer.html's javascript ):
    ...
    // get unity object
    function GetUnity() {
    if (typeof unityObject != "undefined"){
    info("GetUnity: found unity object");
    return unityObject.getObjectById("unityPlayer");
    }
    return null;
    }

    // call to Object.FunctionName("Parameter") in current scene.
    var unity = GetUnity();
    unity.SendMessage("Object", "FunctionName", "Parameter");
    ...

    What i want:
    Restrict access to one object (to handle and validate calls).

    ____________________________________________________________________________
    Please don't come up with "i belive...", "i think..." answers - this is development and not religion.
     
    Last edited: Sep 18, 2012
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Thats not possible at the time. Unity lacks a [ExportFunction] attribute to declare what functions exist in the web handling (similar to flash) at least at the moment.

    But we can hope that this is going to change along Unity 4.x
     
  3. venice

    venice

    Joined:
    Oct 29, 2009
    Posts:
    3
    Thanks for your fast response. I'll have a look at changelog for next unity version.