Advertisement

Set up class members from c++

Started by June 20, 2018 07:35 AM
2 comments, last by _Engine_ 6 years, 5 months ago

Hi!

Currently I am trying to implement script system similar to Unity.

So script will be looks like this:


class NewInst : Interface 
{
  SomeCPPObjectRef@ ref;
  void Update()
  {
    //do some stuff
    ...
  }
}

And I need to create instance of class NewInst and set up class member. Of course both actions must be done from c++ side.

I looked into documentation and looks AngelSAcript is not suitable (((  

Maybe I am wrong and this can be realized but question how it can be done?

I'm not familiar with how Unity works so I'm not entirely sure what you're trying to accomplish, but in AngelScript you can create instances of script classes from C++ side and initialize the members manually if you wish.

You can use the engine->CreateUninitializedScriptObject then enumerate the members and set their values.

The serializer add-on can potentially be used to help understand how to do this.

 

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
18 hours ago, WitchLord said:

I'm not familiar with how Unity works so I'm not entirely sure what you're trying to accomplish, but in AngelScript you can create instances of script classes from C++ side and initialize the members manually if you wish.

You can use the engine->CreateUninitializedScriptObject then enumerate the members and set their values.

The serializer add-on can potentially be used to help understand how to do this.

 

Code from serializer add-on is helped. Thank you :)

This topic is closed to new replies.

Advertisement