Topic Author
Posts: 2
Joined: 06 Feb 2019, 04:43

Confusion about how to use

07 Feb 2019, 16:34

This is a great project you have here. I have got it working in Unity with a minor fault in how I'm thinking about it and want to ask about it.

My setup is I have a GameManager object with a script. This is going to house all of my data. I attached my View to the MainCamera with a script, and I attach the GameManager script as a public variable in this script. I set the View's datacontext to this MainCamera script.

The issue I'm having is when everything's initialized, the camera comes first, so my count of objects is 0. I can redo the count by putting this in the update but I feel that's excessive since it only needs to be calculated once at the start.

So I'm asking. What do you guys normally do in this situation?

If you need specific code, I apologize it will have to wait until I get home.

User avatar
Site Admin
Posts: 2329
Joined: 22 Dec 2011, 19:20

Re: Confusion about how to use

12 Feb 2019, 11:00

From what I understand you are creating the NoesisView component from code and attaching it to the MainCamera, then set its Content.DataContext to be the GameManager instance.

But I don't get what you mean by "my count of objects is 0"... which objects? when do you create those objects?

NoesisView component loads the xaml during its OnEnable message, I don't know if that info helps you figure out when do you have to initialize your data.

Who is online

Users browsing this forum: Logrus and 2 guests