Skip to content

Examples of passing unity objects from c# to lua and lua to c# #44

@plasmalasgun

Description

@plasmalasgun

Can you provide examples:

  • how a unity object created in lua can be passed to c#

//c#
public static int testfunc( ILuaState lua )
{
GameObject pGameObject = (GameObject)lua.ToUserData( 1 );
Debug.Log("pGameObject.name "+pGameObject.name );
{

-- Lua
local goPlaceholder = GameObject._New("testObject")
testfunc( goPlaceholder )

ERROR

NullReferenceException: Object reference not set to an instance of an object

  • how a unity object created in c# can be passed to lua

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions