Michael Hutton
New member
Hi all,
Completely new here so please be patient.
I *thought* I needed behaviour Trees in my project but am coming up against some issues. The project is trying to simulate a hospital and the behaviours of patients etc. (don't ask me why). I have versions which do what I want but want to convert the project to use behaviour trees. I am at the very first stages.
1. I am instantiating gameObjects at runtime. So far I have attached a behaviour tree which references an external behaviour tree. This seems to work. I can set a float on the object and change it's colour. Woo!.
But I am getting confused with variables and the documentation goes a bit deep too quickly. Let's say I instantiate my Patient prefab which successfully runs the behaviour and all the floats logged are different meaning I know the myFloat is diffierent for each tree. Great. If I have a script attached to the object I have a field (can make it a property) called Gender but uses the using UnityEngine.Analytics; which is not a standard 'component'
using UnityEngine;
using UnityEngine.Analytics;
public class PatientProperties : MonoBehaviour
{
public Gender Gender { get; set; }
}
In script I can assign the gender etc but I can't work out how to get/set it in the behaviour tree for that object. Do I have to make this a sharedVariable? I am going round in circles at the moment and need some guidance how to reference scripts on my runtime instantiated gameObjects. If you see what I mean.
I'd be very grateful for any pointers or pointers to threads which discuss this. I am also having difficulty know whether to place a script on the object with all the (often non-standard class types) or put them in the behaviour tree and make custom nodes (which is I suspect what I have to do?
Sorry if this is garbled!
Michael
Completely new here so please be patient.
I *thought* I needed behaviour Trees in my project but am coming up against some issues. The project is trying to simulate a hospital and the behaviours of patients etc. (don't ask me why). I have versions which do what I want but want to convert the project to use behaviour trees. I am at the very first stages.
1. I am instantiating gameObjects at runtime. So far I have attached a behaviour tree which references an external behaviour tree. This seems to work. I can set a float on the object and change it's colour. Woo!.
But I am getting confused with variables and the documentation goes a bit deep too quickly. Let's say I instantiate my Patient prefab which successfully runs the behaviour and all the floats logged are different meaning I know the myFloat is diffierent for each tree. Great. If I have a script attached to the object I have a field (can make it a property) called Gender but uses the using UnityEngine.Analytics; which is not a standard 'component'
using UnityEngine;
using UnityEngine.Analytics;
public class PatientProperties : MonoBehaviour
{
public Gender Gender { get; set; }
}
In script I can assign the gender etc but I can't work out how to get/set it in the behaviour tree for that object. Do I have to make this a sharedVariable? I am going round in circles at the moment and need some guidance how to reference scripts on my runtime instantiated gameObjects. If you see what I mean.
I'd be very grateful for any pointers or pointers to threads which discuss this. I am also having difficulty know whether to place a script on the object with all the (often non-standard class types) or put them in the behaviour tree and make custom nodes (which is I suspect what I have to do?
Sorry if this is garbled!
Michael