Adam's Lair Forum
https://forum.adamslair.net:80/

Can't set EditorHintImage icon for my custom Component
https://forum.adamslair.net:80/viewtopic.php?f=4&t=1234
Page 1 of 1

Author:  LehGogh [ 2018/06/12, 20:23 ]
Post subject:  Can't set EditorHintImage icon for my custom Component

I have a custom Component, SpawnPoint, that I use to handle spawning players at a random spawn point of their team color. I'm trying to give the Component a custom icon by setting EditorHintImage attribute, but it just defaults to the folder icon. Can someone help me figure out where I'm going wrong?

In SpawnPoint.cs:
Code:
[EditorHintImage(ResNames.ImageSpawnPoint)]
public class SpawnPoint : Component, ICmpRenderer
{
     // normal Component code
}


In ResNames.cs:
Code:
public static class ResNames
{
     private const string ManifestBaseName = "TestGame.EmbeddedResources.";
     public const string Category = "TestGame";
     public const string ImageSpawnPoint = ManifestBaseName + "iconResSpawnPoint.png";
}


In my CorePlugin project, I've created a folder "EmbeddedResources". Inside is my 16x16 image with the name iconResSpawnPoint.png. Is there anything else I need in that folder to make it work?

Author:  SirePi [ 2018/06/12, 21:18 ]
Post subject:  Re: Can't set EditorHintImage icon for my custom Component

Hi, and welcome to the gang :mrgreen:

Did you set your pngs as Embedded Resources as compile action?

Author:  LehGogh [ 2018/06/12, 21:40 ]
Post subject:  Re: Can't set EditorHintImage icon for my custom Component

SirePi wrote:
Did you set your pngs as Embedded Resources as compile action?


I thought that Visual Studio automatically handled that. I changed the build action in Visual Studio to "Embedded Resource" and it works great now. Thanks!

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/