C# EntityAttribute is not working with the documention snippet provided.

#1
I have been trying to create a custom C# Component with the SDK for Visual Studio 2017. I have followed along with the tutorial for it on YouTube by Cryengine and "[EntityClass]" doesn't work without

Code: Select all

[EntityClassAttribute](string name="", string category="Game", string helper=null, string icon="prompt.bmp", bool hide=false)
but

Code: Select all

(string name="", string category="Game", string helper=null, string icon="prompt.bmp", bool hide=false)
is displaying many errors. I have provided the code that I have written.

Code: Select all

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using CryEngine; namespace CryEngine.Projects.Game { [EntityClass] [EntityClassAttribute](string name="", string category = "Game", string helper = null, string icon = "prompt.bmp", bool hide = false) class playerEntity : EntityComponent { float _mass; string _geometry; public float Mass { get { return _mass; } set { _mass = value; resetEntity(); } } [EntityProperty(EntityPropertyType.Geometry)] public string Geometry { get { return _geometry; } set { _geometry = value; resetEntity(); } } private void resetEntity() { Entity.LoadGeometry(0, _geometry); Entity.Physics.Physicalize(_mass, PhysicalizationType.Rigid); } } }

Re: C# EntityAttribute is not working with the documention snippet provided.

#2
The EntityClassAttribute is obsolete and has been replaced with the EntityComponentAttribute. As long as your class inherits from EntityComponent it doesn't necessarily need this attribute, but it is recommended to add it so you can specify a unique GUID for the component. If you create your components from the Asset Browser in the Sandbox by right-clicking in there and selecting Create...→C# Asset it will automatically add the required information in the EntityComponentAttribute.

Who is online

Users browsing this forum: No registered users and 6 guests

cron