Alienhead Posted March 8 Posted March 8 Ok I found out why I was silent crashing with CreateInterface() I am pulling my camera from the editor with this code : local camlist = world:GetTaggedEntities("maincamera") if camlist == nil then Notify("ERROR: No camera labeled 'maincamera' in scene!!!") end cam = camlist[1] Then creating my interface: if ConsolePadfont == nil then ConsolePadfont = LoadFont("Fonts/JetBrainsMono-Bold.ttf") end --Create user interface ConsolePadui = CreateInterface(cam, ConsolePadfont, framebuffer.size) Upon until just a day or two ago this worked fine.. And I was deeply puzzled why it kept crashing at createinterface.. Then I removed the Camera from the main scene in the editor, Created my own camera via code. and it works fine. afont = LoadFont("Fonts/JetBrainsMono-Bold.ttf") icam = CreateCamera(world) iface = CreateInterface(icam, afont, framebuffer.size) So not sure if this is a bug or just the way things got changed... but thats what was happening. Quote Alienhead Components and Software
Solution Josh Posted March 8 Solution Posted March 8 It should work if you just cast the entity to a camera: cam = camlist[1] cam = Camera(cam) Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Alienhead Posted March 8 Author Posted March 8 Doh ... Rookie mistake? Your right its working.. Odd i did not have to cast it last few updates ago, but no biggie, I'd rather cast it anyways so i can have typed proof it's the camera. Ty Josh. Quote Alienhead Components and Software
Josh Posted March 8 Posted March 8 CreateCamera returns a Camera object. GetTaggedEntities() returns a table of Entity objects. So the Entity has to be cast to a Camera before it can be used. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.