Adam's Lair Forum

game development and casual madness
It is currently 2017/03/24, 10:14

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: 2014/06/18, 13:23 
Junior Member
Junior Member

Joined: 2014/06/14, 13:55
Posts: 41
Role: Hobbyist
An error with a new Component popped up.
I don't know why and can't seem to get rid of this error.

The full error:
[Core] Error: Error reading object: Can't resolve object reference '3419762700'.
[Core] Warning: Missing or Disposed Component in GameObject 'GameObject "WaterCard/Shadow"'. This should never happen and is likely the cause of malformed data
[Core] Warning: Missing or Disposed Component 'law.Cards.CardShadow' in GameObject 'GameObject "WaterCard/Shadow"'. This should never happen and is likely the cause of malformed data

The Code of law.Cards.CardShadow (which is the only component throwing that error):

Code:
public class CardShadow : Component, ICmpUpdatable, ICmpInitializable
    {
        Vector3 _parentPrevPosition;
        float _parentPrevAngle;

        public void Update()
        {
            Vector3 _parentPosition = this.GameObj.Parent.GetComponent<Transform>().Pos;
            float _parentAngle = this.GameObj.Parent.GetComponent<Transform>().Angle;

            float newXPosition = (_parentPosition.X + 10) * (_parentPosition.Z + 1) * 0.3f;
            float newYPosition = (_parentPosition.Y + 10) * (_parentPosition.Z + 1) * 0.3f;

            float newScale = -_parentPosition.Z * 0.02f;

            Transform shadowTransform = this.GameObj.GetComponent<Transform>();

            shadowTransform.SetTransform(new Vector3(newXPosition, newYPosition, shadowTransform.Pos.Z), newScale, _parentAngle);
        }

        void ICmpUpdatable.OnUpdate()
        {
            if ((this.GameObj.Parent.GetComponent<Transform>().Pos != _parentPrevPosition) || (this.GameObj.Parent.GetComponent<Transform>().Angle != _parentPrevAngle))
            {
                this.Update();
                _parentPrevPosition = this.GameObj.Parent.GetComponent<Transform>().Pos;
                _parentPrevAngle = this.GameObj.Parent.GetComponent<Transform>().Angle;
            }
        }

        void ICmpInitializable.OnInit(Component.InitContext context)
        {
            if (context == InitContext.Activate)
            {
                _parentPrevPosition = this.GameObj.Parent.GetComponent<Transform>().Pos;
                _parentPrevAngle = this.GameObj.Parent.GetComponent<Transform>().Angle;
            }
        }

        void ICmpInitializable.OnShutdown(Component.ShutdownContext context)
        {
            if (context == ShutdownContext.Deactivate)
            {
            }
        }
    }


Top
 Profile  
 
PostPosted: 2014/06/18, 20:12 
Site Admin
Site Admin
User avatar

Joined: 2013/05/11, 22:30
Posts: 1932
Location: Germany
Role: Professional
The errors source is likely to be something else than the code you've posted.

In general, the most likely cause for an error like this is, that you have renamed or removed a Component class that was still used in a GameObject of any Scene or Prefab. Renaming also means "moved from one namespace to another".

Because relics of the Component prior to deletion / renaming still live in your Scene and Prefab Resources, these errors will go away as soon as you load the Scene / Prefab, modify it and save it again. The new version should work fine again.

However, the error you have posted is unlikely to occur all alone, as it is normally accompanied by an error that says something about not being able to resolve a certain Type - so it might be something else. Again, hard to say without more information.

Things that might help pinning it down:
  1. The complete contents of your logfile.
  2. The source code of the Components that are part of the GameObject which references the missing Component.
  3. A list of steps on how to reproduce this error based on a fresh Duality installation.
  4. A reduced game project folder that contains the minimum amount of data and code to reproduce this error - zipped and uploaded somewhere.

_________________
Blog | GitHub | Twitter (@Adams_Lair)


Top
 Profile  
 
PostPosted: 2014/06/24, 22:12 
Junior Member
Junior Member

Joined: 2014/06/14, 13:55
Posts: 41
Role: Hobbyist
Um alright, seems like saving the scene fixed it. And yes there was also a could not resolve type error :D I will post the whole log next time.


Top
 Profile  
 
PostPosted: 2017/01/13, 08:28 
One-Hit Wonder
One-Hit Wonder

Joined: 2017/01/12, 10:53
Posts: 1
Role: Observer
I get the same error, what code was it you deleted?


Top
 Profile  
 
PostPosted: 2017/01/13, 12:47 
Forum Addict
Forum Addict
User avatar

Joined: 2013/09/19, 14:31
Posts: 819
Location: Italy
Role: Hobbyist
Hey, welcome to the forum!

Usually this kind of error happens when you removed some properties from a class, and recompile your plugin.
The editor tries to map the data it currently have (with your old class structure) to the new one, and failing because something in the new structure is now missing.

You should just remove and recreate the Components that used said class, and you should be all set.

_________________
Come on Duality's Discord channel. It's entertaining and productive! :mrgreen:


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group