I'm trying to code into the game a new sort of query tool, I'm doing this by sub-classing the DefaultTool class and overriding the various methods such as "Awake" and "OnToolGUI" which works great
The problem I am having is that I cannot figure out how to correctly register the tool with the ToolManager/ToolController from the ILSpy tool you can see that ToolController loads all the tools from its self in its Awake method:
So I tried to attach my tool class as a component in the OnLevelLoaded method of LoadingExtension like this:
This works in a fashion, as it makes my tool the active tool when the game loads rather than the default tool which has been enough to get me started and move forward with working on my tool but the problem is that I don't think registered properly as tool as I cannot select it again if I choose another tool and try and call this:
This doesn't work at all, I think it should its how the main switches tools.
I really hope one of the devs could shine a light on this and tell me what I'm doing wrong
Thanks
The problem I am having is that I cannot figure out how to correctly register the tool with the ToolManager/ToolController from the ILSpy tool you can see that ToolController loads all the tools from its self in its Awake method:
Code:
private void Awake()
{
this.m_tools = base.GetComponents<ToolBase>();
// snip
Singleton<ToolManager>.instance.InitializeProperties(this);
}
So I tried to attach my tool class as a component in the OnLevelLoaded method of LoadingExtension like this:
Code:
public override void OnLevelLoaded(LoadMode mode)
{
GameObject.FindWithTag("GameController").AddComponent<QueryTool>();
//Mode stuff
}
This works in a fashion, as it makes my tool the active tool when the game loads rather than the default tool which has been enough to get me started and move forward with working on my tool but the problem is that I don't think registered properly as tool as I cannot select it again if I choose another tool and try and call this:
Code:
ToolsModifierControl.SetTool<QueryTool>();
This doesn't work at all, I think it should its how the main switches tools.
I really hope one of the devs could shine a light on this and tell me what I'm doing wrong
Thanks