Skip to content

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

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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