void ChangeTool( GameObject obj ) { if( null == obj ) { Debug.Log( "Cannot change tool to null object" ); return; } if( obj == m_EquippedTool ) { Debug.Log( "Cannot change to tool - this tool is currently equipped" ); return; } Tool nextTool = GetToolScript( obj ); if( null == nextTool ) { Debug.Log( "Cannot locate tool script on object" ); return; } m_PreviousTool = m_EquippedTool; m_PreviousToolScript = m_EquippedToolScript; m_EquippedTool = obj; m_EquippedToolScript = nextTool; m_EquippedToolScript.Attach(); if( m_PreviousToolScript ) m_PreviousToolScript.Detach(); }