How Does SerializeObjectPtr() Work?

This forum is currently in read-only mode.
  • I'm working on the serialization portion of a plugin I'm working on and I need to serialize some pointers to CRunObjects. I've stumbled across this plugin, but I'm not sure how to use it correctly. My thought at the moment is something along these lines:

    CRunObject* obj;
    CRunObject* tempObj;
    ...
    void ExtObject::Serialize(bin& ar)
    {
    	if (ar.loading)
            {
                    pRuntime->SerializeObjectPtr(tempObj, ar);
                    obj = tempObj;
            }
            else
            {
                    pRuntime->SerializeObjectPtr(obj, ar);
            }
    }
    [/code:31ikoddk]
    Unfortunately, this doesn't seem to work quite right.  
    
    [i]I have an expression that returns the X coordinate of "obj".  If I do a quicksave and then a quickload, the returned X coordinate is equal to what it was before the load, but if I move around the object that's being pointed to, the returned X coordinate no longer changes.[/i]
    
    Scratch the stuff in italics, the SerializeObjectPtr() function doesn't seem to be returning anything when I call it in the load portion of serialization.  My pointers remain NULL.
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)