Itsmars Tutorials


(angell) #63

I believe you said the exact same thing to the guy from which i posted the reference above, unfortunatly is not working, and i did exactly what itsmars did with

Set Level of [self] to [[Global integer]AreaLevel]

The Global integer is set and the area level is set on _LevelManager in the scene using plyblox

[[Set Global Value] AreaLevel to [integer] of 2]

If you have any idea pls do explain, thank you very much for your answer.
(is unity dungeon crawler 29 - level up video)

NullReferenceException: Object reference not set to an instance of an object
plyGame.ActorLevel_Set_plyBlock.Run (BlockReturn param) (at D:/Work/u50/SOURCE/plyRPG/Blocks/Character/Actor/ActorLevel_Set_plyBlock.cs:58)
plyBloxKit.plyEvent.Run () (at D:/Work/u50/SOURCE/plyBlox/plyEvent.cs:78)
plyBloxKit.plyBlox.RunEvent (plyBloxKit.plyEvent ev) (at D:/Work/u50/SOURCE/plyBlox/plyBlox.cs:643)
plyGame.EventHandler_Actor.OnActorReady () (at D:/Work/u50/SOURCE/plyRPG/Events/Actor/EventHandler_Actor.cs:105)
UnityEngine.GameObject:BroadcastMessage(String, SendMessageOptions)
plyGame.Actor:Update() (at D:/Work/u50/SOURCE/plyRPG/Game/Character/Actor/Actor.cs:503)


(Leslie Young) #64

That nullref can only occur if the “ActorClass” object of the actor is null,or if the “to” (value) field of the Block is not set. The field is set Global integer.AreaLevel, so it must be the ActorClass that is not read on the Actor yet.

  • In what event are you using this?
  • Does your character’s Actor component have its ActorClass set? Well, I guess you would have seen an error about this if it was not the case.
  • This is the 1st error message in the console? Always sort them out from top to bottom since 1st error could lead to a later error.

(angell) #65

Thank you Leslie for trying to help me, so…the error i get is only when i activate the final plyblox on the monster, the other plybloxes are set and are not making any error, just the final one, i’ve made sure to check if i did everything good and it seems i did, i also have to mention i had to make a lot of debugging because of unity 2018, when itsmars made the tutorials he was using unity 2015, until now i had no problems but this thing got me good.

This is the first and only error i have in the list, in the rest i only have a warning

No script asset for GameObjectSelectionItem. Check that the definition is in a file of the same name.

The plyblox on the monster is

OnActorReady (itsmars made this with OnStart)
      Set Level of [self] to [AreaLevel as integer]

And again i only get the above error when i activate the monster plyblox related to AreaLevel global integer.


I have to mention that i also receive an error that is unrelated to this subject when i change scenes from scene2 back to scene 1, i also haven't figured this one yet.

NullReferenceException: Object reference not set to an instance of an object
plyGame.Actor.DeleteSaveData (System.String key) (at D:/Work/u50/SOURCE/plyRPG/Game/Character/Actor/Actor.cs:460)
plyGame.PersistableObject.DeleteSaveData () (at D:/Work/u50/SOURCE/plyGame/System/Persistable/PersistableObject.cs:180)
plyGame.PersistableObject.OnDestroy () (at D:/Work/u50/SOURCE/plyGame/System/Persistable/PersistableObject.cs:67)


(angell) #66

I finay managed to fix it, from plyblox i set

On Start
if [
[[self] is Actor]
Set Level of [self] to [AreaLevel as integer]
]

And is really working, i’ve set AreaLevel to 5 and the monster is now level 5

And also the warning i had is gone.

Now the only thing that remains is that error i get when i change scenes that i explained earlier
Thank you Leslie.


(Leslie Young) #67

Oh, I see. You were passing the GameObject (-self-) rather than the Actor component which is on that object and which is what contains the ActorClass information (which has the Level).

Blox is normally able to deal with this and get the required component from the object itself, but I guess there was some edge case here.

Now the only thing that remains is that error i get when i change scenes that i explained earlier

The exact line that error occurs on reads…actorClass.DeleteSaveData(key); so again we are dealing with this ActorClass. hehe.

How are you loading the scene? It sounds like plyGame’s persistence system does not know that scene loading is running and then making a call to delete persisted values during an OnDestroy - trying to mark the character as destroyed, thinking it was killed rather than the level loading being the cause of it being destroyed.

Use Flow > System > Load Level or if you are scripting then use, plyUtil.LoadLevel(...);


(angell) #68

I was using Flow > LoadLevel, and after i also fixed the second scene, it seems that it also fixed the last error, i checked and rechecked, so i’m free to implement new things now :D, working on implementing inventory pro with plygame, and i think i’m on the right track, thank you Leslie for all your help.