Exception in MCS character in Unity - unity3d

I have these errors when I run my Unity project. They are related to a MCS character. These error cause other components to break. For example SALSA Lip-sync was not working correctly because this error was affecting the BlendShapes that are used by SALSA.
Error:
NullReferenceException: Object reference not set to an instance of an object
MORPH3D.COSTUMING.CostumeItem.setLODLevel (Single lodlevel, Boolean broadcast_change)
MORPH3D.COSTUMING.CIhair.setLODLevel (Single lodlevel, Boolean broadcast_change)
MORPH3D.SERVICES.CostumeModel.SetItemLODLevel (Single level)
MORPH3D.M3DCharacterManager.SyncCurrentLODLevel (Single level)
MORPH3D.M3DCharacterManager.initCharacterManager (Boolean refresh)
MORPH3D.M3DCharacterManager.Start ()
Warning:
Unable to find first CoreMesh/LOD in costume item: ShortPonytailHair, your asset will likely break and not work
UnityEngine.Debug:LogWarning(Object)
MORPH3D.COSTUMING.CostumeItem:DetectCoreMeshes()
MORPH3D.COSTUMING.CIhair:DetectCoreMeshes()
MORPH3D.M3DCharacterManager:DetectAttachedHair()
MORPH3D.M3DCharacterManager:initCharacterManager(Boolean)
MORPH3D.M3DCharacterManager:Start()

The problem turn up to be in one of the assets - the hair. The Mesh Type of the "C Ihair (script)" was incorrectly set to "body". It must be changed to "hair".

Related

"NullReference" when I tried to respawn the Player when enter collision or fall in to the void

I got an error "NullReferenceException: Object reference not set to an instance of an object.
PlayerCollision.OnCollisionEnter (UnityEngine.Collision collisionInfo)
(at Assets/Scripts/PlayerCollision.cs:15)
"
I tried to make a script when I enter collision ill respawn but it works only on the first try but it don't work on the second try.
oh for some reason in the build settings i got checked level1 then i unchecked it and it does not have any error now but thanks

ARAnchorManager.HostCloudAnchor(anchor) returns null — ARCore Extensions for AR Foundation

Calling ARCloudAnchor cloudAnchor = manager.HostCloudAnchor(anchor) gives null for cloudAnchor (where manager is of type ARAnchorManager and anchor is of type ARAnchor). I have the API key set up for ARCore Extensions with the GCP server. Help is much appreciated.
Maybe your feature map quality is not good. Try to call manager.EstimateFeatureMapQualityForHosting(GetPoseCamera()) to check the quality
INSUFFICIENT: it is not good enough to resolve cloud anchor later (host anchor can be failed with this quality and you may receive NULL for cloud anchor) -> try to move device around object.
SUFFICIENT: it is okay
GOOD: it is good
Note: You have to define GetPoseCamera() function. (it is easy, just includes position and rotation of camera)
Took me a while, but I fixed this.
Even though the ARCore Extensions sample gave cloudAnchor.cloudAnchorState == CloudAnchorState.Success immediately when calling manager.HostCloudAnchor, I got cloudAnchor.cloudAnchorState == CloudAnchorState.TaskInProgress which made cloudAnchor == null give true. I needed to loop until the state was Success (which took about 5 seconds each time). After the wait, the anchors are hosted without a hitch.

Unexpected behavior from Drools' collectSet and difficulty effecting undo moves

What I actually wanted to do is to have a Drools rule as so:
rule "globalRequiredPredecessorAfterMe"
when
$rpAll: Set(size>1) from accumulate (
Customer(vehicle!= null, vehicle.vehicleTyp != VehicleTyp.DUMMY, $rpAfterMe: requiredPredecessorsAfterMe);
collectSet($rpAfterMe)
)
then
scoreHolder.addMediumConstraintMatch(kcontext, - $rpAll.size()-1);
end
Unfortunately, on the second move in CH drools awards me with a
Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException
at org.drools.core.rule.SingleAccumulate.reverse(SingleAccumulate.java:124)
...
Is this a feature?
I swallowed my pride and to wrote a fantastically complex Listener which is supposed to to what the Drools rule above did. With an assertionScoreDirectorFactory (an EasyScoreCalculator) I get score corruption. On a closer look, I get a corruption in one of the two cases:
My planning entity's previousXXX is set exactly to the same value
An Undo move is done
To investigate, I set the solution to the state just before the score corruption occurs. I use the CreateChangeMoves from Optaplanner's 7.4.1.Final SolutionBusiness class. (On a side note, it would be really helpful if one could also set a MoveCountLimit in the SolverConfig.)
So I create the scoreDirector as follows
SolverFactory<MySolution> solverFactory = SolverFactory.createFromXmlResource(
SolverConfigXML);
solver = solverFactory.buildSolver();
ScoreDirectorFactory<MySolution> scoreDirectorFactory = solver.getScoreDirectorFactory();
scoreDirector = scoreDirectorFactory.buildScoreDirector();
scoreDirector.setWorkingSolution(unsolvedSolution);
within a JUnit 5 test and then perform several ChangeMoves to mimick the solution just before the offending move occurs. However, when I perform the offending move as in bullet 1 above,
// customer SUK0002030's previousVehicleOrCustomer is DUMMY_3
cm = createChangeMove(nameToCustomerMap.get("SUK0002030"), "previousVehicleOrCustomer", nameToVehicleMap.get("DUMMY_3"));
cm.doMove(scoreDirector);
I get a
java.lang.IllegalStateException: The entity (SUK0002030) has a variable (previousVehicleOrCustomer) with value (DUMMY_3) which has a sourceVariableName variable (nextCustomer) with a value (null) which is not that entity.
Verify the consistency of your input problem for that sourceVariableName variable.
at org.optaplanner.core.impl.domain.variable.inverserelation.SingletonInverseVariableListener.retract(SingletonInverseVariableListener.java:87)
...
When I set the previousVehicleOrCustomer to null, and then back to DUMMY_3, everything is fine and no score corruption occurs.
Similarly, when attempting to create an (offending) UndoMove of the previous Move cm, bullet 2 above, as so
cm.createUndoMove(scoreDirector).doMove(scoreDirector)
I get the same message:
java.lang.IllegalStateException: The entity (SUK0002014) has a variable (previousVehicleOrCustomer) with value (Vehicle_0) which has a sourceVariableName variable (nextCustomer) with a value (null) which is not that entity.
Verify the consistency of your input problem for that sourceVariableName variable.
at org.optaplanner.core.impl.domain.variable.inverserelation.SingletonInverseVariableListener.retract(SingletonInverseVariableListener.java:87)
...
Of course, if I manually create the UndoMove (by simply setting the previousVehicleOrCustomer back to null), everything is fine.
These moves really should be possible and I'm really curious to find out what's wrong.

Unity5.6 Collision2D contact points array index out of range error

When I updated my Unity version 5.5 to 5.6, an error occured about the Collision2D.contacts array. When I try to access the contacts array, I can not get contact point info now.
void OnCollisionExit2D(Collision2D col)
{
if (col.gameObject.CompareTag("Ground"))
{
if ((_transform.position.y - col.contacts[0].point.y) > colliderHeight / 2 + .15f)
{
Debug.Log ("Contact count = " + col.contacts.Length);
_onGround = false;
ParticleController.PlayDustEffect ();
}
}
}
Error Log :
IndexOutOfRangeException: Array index is out of range.
Player.OnCollisionExit2D (UnityEngine.Collision2D col) (at Assets/Scripts/CharacterController/Player.cs:759)
How can I fix the error?
Thanks for your time.
It seems the exit point of collision is not computed anymore in Unity 5.6. Some changes about collisions detection have been changed in this version:
Physics: The internal 2D contact processing has been completely re-written, providing a more robust and reliable reporting of contacts.
I guess the logic for it is the following: why would there be a contact point if the two colliders are not touching each other anymore? As there is no contact point anymore, col.contacts is empty there. So when you are trying to access col.contacts[0], the element doesn't exist, triggering the IndexOutOfRangeException.
From the Collision.contacts documentation (not the Collision2D.contacts one, but I suppose the behavior is the same):
Every contact contains a contact point, normal and the two colliders that collided (see ContactPoint). From inside OnCollisionStay or OnCollisionEnter you can always be sure that contacts has at least one element.
So OnCollisionExit does not, in any case, guarantee the presence of at least one point in col.contacts.
For those searching for ArrayIndexOutOfRange errors while trying to access the ContactPoint2D on a Collision2D, it seems that the API is now:
collision.getContacts(myContacts)
where you initialize and pass in an empty array myContacts. See more about this in the documentation about Collision2D.contacts which says:
The specific points of contact with the incoming Collider2D. You
should avoid using this as it produces memory garbage. Use
GetContacts instead.

Exception when running on simulator 3.2

I'm testing my app on simulator 3.1.3, it runs fine.
When it come to simulator 3.2, it crashes right from the beginning:
2010-06-24 16:35:29.208 MyTestApp[6991:207] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'This coder requires that replaced objects be returned from initWithCoder:'
2010-06-24 16:35:29.213 MyTestApp[6991:207] Stack: (
46195275,
2520474889,
46194715,
46194554,
6387912,
6392266,
5568184,
6388086,
6386450,
6392266,
5564974,
5573454,
3555255,
3560368,
3586056,
3567777,
3599431,
52998524,
45735996,
45731912,
3559044,
3591649,
10824,
10678
)
As far as I know, I do not use the "initWithCoder" method (do not really know what this is though).
How can I know where the exception is thrown so I could have a better understanding of what is causing the problem?
ps: I have added an exception in Breakpoint: objc_exception_throw (with location libobjc.A.dylib, strangely I had to enter the location manually, I expected xcode to find it for me when I added objc_exception_throw). But still the same trace and no more information.
This page should provide some helpful info: Debugging Tips for Objective-C
Of particular interest is the console command info line *. Every one of those numbers listed by the exception log is an address on the stack. Those bottom ones in the 10,000 and below range are usually located in the app's main method, for example. The highest ranged addresses tend to represent the default libraries.
Using the command info line *10678 would likely return some info about a specific line in the main method, which doesn't help very much. Normally the trick is to find the highest address before the default libraries begin. I'm unsure how much this will help your problem in particular, seeing as there's a huge gap between the expected small addresses and the next highest up. In any case, start with the smallest address above the bottom two (3555255 from what I can see in the log you posted) and see if it returns a line from one of your own code files. If it does, check the one above it, and so on until you find the last address from your own code. Hope this helps.
I figured out the reason of this error. I had created an object of type NSDictionnary within IB and it seems it was not the correct way to do this. Instead I have programmatically created this same object in XCode and this works fine. Seems like it was some kind of persistent problem.