rudolf_iron Posted 22 hours ago Posted 22 hours ago pls how true code , i bad coder. local world1 = Entity:GetWorld() --error 0 local pref = Entity LoadPrefab(self.world1, "pref/test_obj.pfb") -- true self.pref:Move(0.0,0.0,0.0) -- error 1 Quote
Josh Posted 21 hours ago Posted 21 hours ago What is the name of the Lua script file this code is placed in? Is this in main.lua or in an entity script? Quote Let's build cool stuff and have fun.
rudolf_iron Posted 20 hours ago Author Posted 20 hours ago no, i make folder "Entity->guntils" . in folder. new script. if i not true coding. sry, i not pro :-) full code -- source_code: \test_lua_scene\Scripts\Entities\GUntils\MgetWorld.lua MgetWorld = {} local world0 = CreateWorld() local world1 = Entity:GetWorld() --MgetWorld.world1 = Entity:GetWorld() --function MgetWorld:Loader(mapNameExteriorList) --argv map -- --end function MgetWorld:Start() --if world0 == nil or pref == nil then -- Print("error : MgetWorld -> not path or world ") -- return 0 --end local pref = Entity LoadPrefab(self.world1, "pref/test_obj.pfb") self.pref:Move(0.0,0.0,0.0) Print("MgetWorld : done") end function MgetWorld:Update() end --RegisterComponent("MgetWorld", MgetWorld) --return MgetWorld Quote
Josh Posted 20 hours ago Posted 20 hours ago You should not create a new world in an entity script. The world is already created for you. MgetWorld = {} function MgetWorld:Start() self.pref = LoadPrefab(self.world, "pref/test_obj.pfb") if self.pref ~= nil then self.pref:Move(0.0, 0.0, 0.0) Print("MgetWorld : done") end end function MgetWorld:Update() end Quote Let's build cool stuff and have fun.
rudolf_iron Posted 20 hours ago Author Posted 20 hours ago Thank you, I am very grateful to you. 1 Quote
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.