- Home /
Save Texture in lua table
Hi I'm making my game moddable using MoonSharp. http://www.moonsharp.org/
I'm trying to have a Table represent a Texture2D class. I currently have Vector classes and rect classes working. The way i'm calling Unity functions such as GUI.Box is making a wrapper function that takes a rect represented in a table and converting it to a Rect and it also takes in a string for content.
Maybe I can do something like this which will return a table with the texture information or maybe a key and I can store my textures in a Dictionary? I'm not really sure.
texture2D = LoadTexture2D("Path");
I Have seen a more direct approach in this video using NLua and I have no idea how that was done. https://www.youtube.com/watch?v=dTI9_dGljmY
Here is my current LUA CODE
position = {0,0,0};
rect = {0,0,100,100};
function Start ()
SetPosition(position);
end
function Update()
position[2] = position[2] + 1 * GetDeltaTime();
DebugLog(position[2]);
SetPosition(position)
end
function LateUpdate()
end
function OnGUI ()
GUIBox(rect,"I LIKE LUA");
end
Your answer
Follow this Question
Related Questions
Changing an HDRP material's texture at run time. SOLVED - see further reply 1 Answer
Changing from static texture to video texture & play video? 0 Answers
How to change material that is being scrolled for Material.SetTextureOffset 2 Answers
Changing texture when movie is paused 0 Answers
Can't see text for menu in unity with a texture placed 1 Answer