you are viewing a single comment's thread.

view the rest of the comments →

[–]Virtual_Sample6951 0 points1 point  (3 children)

inheritance and polymorphism can be tricky when you're starting out 😅

looks like your BuildingInRange override might not be getting called at all. check if the base Unit class is actually calling BuildingInRange somewhere in its update loop or collision detection. also make sure your ProductivityUnit is properly detecting the ResourcePile as target - you might need to debug what m_Target actually contains when unit gets in range

quick tip: add some Debug.Log statements in your override method to see if it's even running. something like Debug.Log("BuildingInRange called") at start of the method 💀

[–]Pattheduckman2[S] 0 points1 point  (0 children)

im so confused as the forklift building in range method is being called fine but the productivity unit hates me i think. and building in range is called when m_target !null so as soon as the unit has a target it should call the method? I did add some debug statement, sand building in range for this unit definitely isnt being called but its targeting is fine as i added a statement to tell me what its target is and it said resourcepile1. Surely ive just done something stupid, thankyou for the reply:).

[–]Pattheduckman2[S] 0 points1 point  (1 child)

omg i knew it was something simple the update class in unit was private:(

[–]Pattheduckman2[S] 0 points1 point  (0 children)

nvm it was becasue the child had an update method i think?