How to serialize variable so it can be tweaked in the the inspector

Hey all I've just recently got in to CryEngine (just today) because of the step CryTek are taking on improving CryEngine.
Especially the c# integration, even though there are some small issue i do believe CryTek will improve the integrate to be seamless.
Alright so the question I've got is that in unity you can serialize you variable or just make it public so it can be displayed in the inspector.
Could you also do that with CryEngine? If so could somebody show me a code example of it?

Thank you and keep up the good work CryTek!

Re: How to serialize variable so it can be tweaked in the the inspector

Hi KhalidDahir,

It is rather easy to expose a variable to the property inspector inside the editor for components. Assuming you have a component, you can expose values to the editor like so;

Code: Select all

[EntityProperty(EntityPropertyType.Primitive, "Speed of the player in meters per second.")]
public float MoveSpeed { get; set; } = 20.5f;
This is an excerpt taken from the Third Person Shooter C# template from 5.6.5. If you open the template in Sandbox, then navigate to the Code folder inside the Asset Browser you will notice several "C# Assets" here. If you open the Player asset by double-clicking it you will see an example of a component with exposed sandbox variables.

Hope this helps
CRYENGINE Technical Community Manager
Here to help the community and social channels grow and thrive.

My personal belongings;
Beginner Guides | My GitHub | Splash Plugin

Who is online

Users browsing this forum: No registered users and 7 guests