I have two classes: HelicopterTrigger and HelicopterSpawner. Both inherit from AActor. I don’t know how to set a bool variable IsShouldSpawn from HelicopterTrigger to HelicopterSpawner to spawn an object.
In HelicopterSpawner, the bool variable IsShouldSpawn is FALSE and object isn’t spawned, but a trigger in HelicopterTrigger will set the bool variable to TRUE and the object is spawned because if IsShouldSpawn is TRUE, the object is spawned.
In other words, how to communicate between these two classes. How to get the bool variable IsShouldSpawn from HelicopterSpawner inside HelicopterTrigger to set it to other value. Should I cast? But what to what?
One simple solution would be to crate an UpdateShouldSpawn(bool SpawnUpdate) function with a boolean parameter inside your Spawner class. This function can then update the IsShouldSpawn variable based on the boolean passed in using IsShouldSpawn = SpawnUpdate;. Then, to call this function from your Trigger class, you would just need to add AHelicopterSpawner::UpdateShouldSpawn(true/false) where you want the update to occur.
And after a compilation SetbIsOneBH: identifier not found.
So the Trigger class doesn’t see the function SetbIsOneBH(true) in the Spawner class.
In reality, I tried this solution before, but still this problem. I can add that I have the Spawner class included in the Trigger class in h. and .cpp.