rudolf_iron Posted 8 hours ago Posted 8 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 7 hours ago Posted 7 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 6 hours ago Author Posted 6 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 6 hours ago Posted 6 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 6 hours ago Author Posted 6 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.