I’m just wondering what’s the best route regarding auto-assigning a non-local gameObject into the “Target” variable slots. Because for the project that i’m working on, it requires spawning in NPC’s with their behaviours however when they spawn, their targets are null.
What i’m having trouble with is having two prefabs interact with each other. An example i’d like to have, is to make a hunter chase after a fleeing animal (from the hunter) as they’re both spawned in.
I believe a good way of achieving this is to use the method “findobjectswithtag” and assign the result but i’m unsure where exactly i can put this method of code, or even if it’s possible to customise a blackboard variable inside a script.
Hey,
Thanks for letting me know that you’ve resolved the issue 🙂
For your information, yes, you can also completely modify a blackboard variable from within one of your scripts using a few methods as long as you get a reference to the Blackboard component. Here is an example:
1
2
3
4
5
6
7
//Get the value of variable named "number" which is of type float