Timeline for Unity MonoBehaviour seems to have another scope
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 7, 2018 at 11:38 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Feb 4, 2018 at 4:19 | history | bumped | CommunityBot | This question has answers that may be good or bad; the system has marked it active so that they can be reviewed. | |
Oct 28, 2017 at 14:54 | comment | added | fj123x | Done, you can close the question if you want, thanks! | |
Oct 28, 2017 at 14:53 | answer | added | fj123x | timeline score: 1 | |
Oct 28, 2017 at 14:37 | comment | added | DMGregory♦ | If you've solved the issue, it's better to post the solution as an Answer so it's easy for other devs who have similar issues to find your solution and learn from your experience. | |
Oct 28, 2017 at 14:24 | history | edited | fj123x | CC BY-SA 3.0 |
added 271 characters in body
|
Oct 28, 2017 at 14:14 | comment | added | fj123x | updated a bit more | |
Oct 28, 2017 at 14:09 | history | edited | fj123x | CC BY-SA 3.0 |
added 921 characters in body
|
Oct 28, 2017 at 13:37 | comment | added | fj123x | I load the enemy from a prefab: Resource.load<GameObject>("Prefab/Enemy");, and then I construct the Enemy: new Enemy(gameObject);, and then i Instantiate the GO with ...Instantiate(gameObject);, and finally I set the enemy to the behaviour: enemyGameObject.transform.GetComponent<EnemyBehaviour>().set(this); | |
Oct 28, 2017 at 13:09 | comment | added | DMGregory♦ |
I'm unable to reproduce the issue from the information given here. In my tests, the update method prints null only before I've assigned an instance of the Enemy class to the enemy member variable, as expected. Once I've assigned a reference to that member variable, the Update method prints non-null from then on. Can you try to construct a complete verifiable test case?
|
|
Oct 28, 2017 at 13:04 | comment | added | sebas | Hello, there is a vital missing information there. When do you call set? | |
Oct 28, 2017 at 11:51 | history | asked | fj123x | CC BY-SA 3.0 |