Jump to content

Prefabs loaded via script not appearing


tinyboss
 Share

Recommended Posts

Note: I'm very new to Leadwerks, so most likely I'm missing something obvious.

 

I've created a 512x512 floor block and I'm trying to load a 4x4 square of them with the following code:

--Dynamically create some dungeon geometry:
System:Print("loading dynamic floor")
self.floors = {}
for i = 1, 4 do
for j = 1, 4 do
floor = Prefab:Load("Prefabs/Tinyboss/floor2.pfb")
table.insert(self.floors, floor)
floor:SetPosition(2048+512*i, 0, 512*j)
System:Print(floor:GetPosition().x.." "..floor:GetPosition().y.." "..floor:GetPosition().z)
end
end
self.FirstTime = false

 

(I put it at the end of the App:Start function in app.lua. I also tried running it once in the App:Loop function, but that didn't help.)

 

When I run with F6, I see all the stuff that I've added in the editor, but none of the dynamically loaded floor tiles show up. I can tell from the print statements that entities are getting loaded and their positions are being set, but I don't see any of them.

 

Is there something else I need to do to add them to the current scene, or something else I'm missing here? Thanks!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...