Jump to content

ModUtil::AddKAnim


Recommended Posts

When exactly can the AddKAnim functionality of ModUtil be called? I understand that it needs to be called before Assets::OnPrefabInit() because that method uses the ModLoadedKAnims list that AddKAnim adds animations to. Additionally I would expect that it needs to be called before any buildings, etc... are loaded because they have to be able to reference the loaded animations by the assigned strings. I attempted calling AddKAnim as a prefix of the OnPrefabInit method of Assets which caused a successful load. But as soon as the game attempted to render a building using the added KAnim it started throwing "Null build for anim!!" and kinda locked up.

Is there any guide/reference on how to use this AddKAnim functionality? I was simply trying to use it with one of the existing kanims built into the game's resource files (i.e. made a copy of the kanim, build, and texture and then loaded them as textassets and texture2d like AddKAnim expects to be called with).

 

log file:

[23:23:06.113] [1] [WARNING] object_dispenser_kanim ui placeSymbol [ 0x0 ] is missing
[23:23:48.740] [1] [ERROR] Assert failed: Null build for anim!!  AlgaeGrowerPreview(2680544)_visualizer my_test_kanim
[23:23:48.760] [1] [INFO] Error occurred with mods active. Disabling all mods.
Assert failed: Null build for anim!!  AlgaeGrowerPreview(2680544)_visualizer my_test_kanim
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
Debug:LogError(Object) (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\Plugins\Debug.cs:127)
Debug:Assert(Boolean, Object) (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\Plugins\Debug.cs:173)
DebugUtil:Assert(Boolean, String, String, String) (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\Plugins\Klei\util\DebugUtil.cs:36)
KBatchedAnimController:SetBatchGroup(KAnimFileData) (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\animation\KBatchedAnimController.cs:157)
KBatchedAnimController:LoadAnims() (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\animation\KBatchedAnimController.cs:195)
KBatchedAnimController:OnAwake() (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\animation\KBatchedAnimController.cs:632)
KAnimControllerBase:Awake() (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\animation\KAnimControllerBase.cs:513)
UnityEngine.GameObject:SetActive(Boolean)
BuildTool:OnActivateTool() (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\game\InterfaceTools\BuildTool.cs:71)
InterfaceTool:ActivateTool() (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\game\InterfaceTools\InterfaceTool.cs:37)
PlayerController:ActivateTool(InterfaceTool) (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\game\PlayerController.cs:139)
BuildTool:Activate(BuildingDef, IList`1, GameObject) (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\game\InterfaceTools\BuildTool.cs:121)
PlanScreen:OnRecipeElementsFullySelected() (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\ui\PlanScreen.cs:1222)
Util:Signal(Action) (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\Plugins\Klei\util\Util.cs:498)
ProductInfoScreen:ActivateAppropriateTool(BuildingDef) (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\ui\ProductInfoScreen.cs:408)
ProductInfoScreen:onMenuMaterialChanged() (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\ui\ProductInfoScreen.cs:398)
MaterialSelector:OnSelectMaterial(Tag, Recipe, Boolean) (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\ui\MaterialSelector.cs:165)
MaterialSelector:AutoSelectAvailableMaterial() (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\ui\MaterialSelector.cs:283)
MaterialSelectionPanel:AutoSelectAvailableMaterial() (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\ui\MaterialSelectionPanel.cs:158)
ProductInfoScreen:SetMaterials(BuildingDef) (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\ui\ProductInfoScreen.cs:374)
ProductInfoScreen:ConfigureScreen(BuildingDef) (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\ui\ProductInfoScreen.cs:119)
PlanScreen:OnSelectBuilding(GameObject, BuildingDef) (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\ui\PlanScreen.cs:501)
<CreateButton>c__AnonStorey1:<>m__0() (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\scripts\ui\PlanScreen.cs:931)
Util:Signal(Action) (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\Plugins\Klei\util\Util.cs:498)
KToggle:Click() (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\Plugins\Klei\ui\KToggle.cs:83)
KToggle:OnPointerClick(PointerEventData) (at D:\JenkinsWorkspace\Preview_Simgame_Windows\game\Assets\Plugins\Klei\ui\KToggle.cs:127)
UnityEngine.EventSystems.ExecuteEvents:Execute(IPointerClickHandler, BaseEventData) (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\EventSystem\ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1) (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\EventSystem\ExecuteEvents.cs:261)
UnityEngine.EventSystems.StandaloneInputModule:ProcessMousePress(MouseButtonEventData) (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\EventSystem\InputModules\StandaloneInputModule.cs:569)
UnityEngine.EventSystems.StandaloneInputModule:ProcessMouseEvent(Int32) (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\EventSystem\InputModules\StandaloneInputModule.cs:466)
UnityEngine.EventSystems.StandaloneInputModule:ProcessMouseEvent() (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\EventSystem\InputModules\StandaloneInputModule.cs:446)
UnityEngine.EventSystems.StandaloneInputModule:Process() (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\EventSystem\InputModules\StandaloneInputModule.cs:221)
UnityEngine.EventSystems.EventSystem:Update() (at C:\buildslave\unity\build\Extensions\guisystem\UnityEngine.UI\EventSystem\EventSystem.cs:294)

Link to comment
Share on other sites

  • Developer

Hey @test447!

This util function is actually a bit out of date from earlier mod system experiments, so I can't vouch for it working correctly at all. That said, some time in the future (at least once the current batch of supported mod features settles down) we're going to be looking at making it easier to mod content into the game.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...