thehankinator Posted January 27, 2015 Share Posted January 27, 2015 I have a simple script like the one below applied to a Pivot. I've dragged my player entity into the "Target" property. When the Start function is called it prints out "target=nil". If I drag some other entity into the Target property I get something like "target=userdata: 0x04245938", which is what I was expecting when my Target is Player. Is there something special about the Player entity? Script.target = nil --Entity "Target" function Script:Start() System:Print("target="..tostring(self.target)) end Quote Link to comment Share on other sites More sharing options...
thehankinator Posted January 28, 2015 Author Share Posted January 28, 2015 I've not decided what this means yet but I've modified my Start function to search for the player entity. It finds it! So I know the player entity exists at the time Start is executed. function Script:Start() System:Print("target="..tostring(self.target)) for x=0,App.world:CountEntities()-1 do local entity = App.world:GetEntity(x) if entity:GetKeyValue("name") == "Player" then System:Print("entity="..tostring(entity)) end end end Quote Link to comment Share on other sites More sharing options...
Rick Posted January 28, 2015 Share Posted January 28, 2015 We have to see more. Screenshot of your scene tree view or something. Quote Link to comment Share on other sites More sharing options...
thehankinator Posted January 29, 2015 Author Share Posted January 29, 2015 I tried to capture all the relevant information in the following screen shots. Thanks for your help. Scene: https://drive.google.com/file/d/0B8AlYY49_v2bdVNpNVpoMUdfZE0/view?usp=sharing Script: https://drive.google.com/file/d/0B8AlYY49_v2beWNWWlVMcW5Zd3M/view?usp=sharing Quote Link to comment Share on other sites More sharing options...
Rick Posted January 29, 2015 Share Posted January 29, 2015 And what is Player? Is it the player prefab or something different? Are you able to reproduce this isolated case in another test project? Have you removed and readded Player in the script tab? Quote Link to comment Share on other sites More sharing options...
thehankinator Posted January 29, 2015 Author Share Posted January 29, 2015 The player is the prefab that comes with LE(although I did add a weapon). I have deleted the pivot and created a new one then added the script. Thinking about all this, I tried deleting the player entity from the scene and re-adding it. This cleared up the issue! I guess I should have tried that hours earlier. Thanks again Quote Link to comment Share on other sites More sharing options...
Rick Posted January 29, 2015 Share Posted January 29, 2015 Clearly an LE bug. Did you happen to save the map file that has this bug so you could give it to Josh in a bug report? This shouldn't happen and he can examine the map file further to see why it did. Quote Link to comment Share on other sites More sharing options...
holschuh Posted January 29, 2015 Share Posted January 29, 2015 Hi, i had this aso after the Beta Update with an lua script targeting a camera. Removing the script saving and rebuild the dependencies of the scrpt after reload solved this. cu Quote Link to comment Share on other sites More sharing options...
thehankinator Posted January 29, 2015 Author Share Posted January 29, 2015 Damn, I had saved it after I got it working. I'll keep things around next time. How do you rebuild the dependencies? Quote Link to comment Share on other sites More sharing options...
holschuh Posted January 29, 2015 Share Posted January 29, 2015 Hi, nothing special it was an 3rd person characer controller script i had to drag an camera in again. cu Quote Link to comment Share on other sites More sharing options...
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.