Jump to content

OnPartAttached ?


Recommended Posts

Just did some testing with these events, and they fired when I added parts:

		public void Start()
		{
			GameEvents.onEditorShipModified.Add(OnShipModified);
			GameEvents.onEditorPartPlaced.Add(OnPartPlaced);
		}
		public void OnDisable()
		{
			GameEvents.onEditorShipModified.Remove(OnShipModified);
			GameEvents.onEditorPartPlaced.Remove(OnPartPlaced);
		}
		private void OnShipModified(ShipConstruct sc)
		{
			// Do stuff
		}
		private void OnPartPlaced(Part p)
		{
			// Do stuff
		}

 

Link to comment
Share on other sites

they're not firing for me... strange.


        /// <summary>
        /// Called when this module is activated.
        /// </summary>
        public void Start()
        {
            GameEvents.onEditorPartPlaced.Add(OnPartPlaced);
        }


        /// <summary>
        /// Called when this module is deactivated.
        /// </summary>
        public void OnDisable()
        {
            GameEvents.onEditorPartPlaced.Remove(OnPartPlaced);
        }


        /// <summary>
        /// Called when a part is attached.
        /// </summary>
        /// <param name="data">The data.</param>
        public void OnPartPlaced(Part data)
        {
            ScreenMessages.PostScreenMessage("PartAttached()");

 

The screen message is never displayed which means the method isn't being called.

Link to comment
Share on other sites

1 hour ago, Xyphos said:

they're not firing for me... strange.



        /// <summary>
        /// Called when this module is activated.
        /// </summary>
        public void Start()
        {
            GameEvents.onEditorPartPlaced.Add(OnPartPlaced);
        }


        /// <summary>
        /// Called when this module is deactivated.
        /// </summary>
        public void OnDisable()
        {
            GameEvents.onEditorPartPlaced.Remove(OnPartPlaced);
        }


        /// <summary>
        /// Called when a part is attached.
        /// </summary>
        /// <param name="data">The data.</param>
        public void OnPartPlaced(Part data)
        {
            ScreenMessages.PostScreenMessage("PartAttached()");

 

The screen message is never displayed which means the method isn't being called.

Maybe try just putting it in the log? Debug.Log("Part attached"); ?

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...