playMaker

Author Topic: SetParent Canvas Issue (and alternative action)  (Read 35 times)

Thore

  • Junior Playmaker
  • **
  • Posts: 63
    • View Profile
SetParent Canvas Issue (and alternative action)
« on: September 22, 2018, 02:14:21 PM »
Hello,

When using "Set Parent" on objects within the canvas, Unity will throw the error notification shown below. It still lets you play, but there are scaling issues.

Code: [Select]
Parent of RectTransform is being set with parent property. Consider using the SetParent method instead, with the worldPositionStays argument set to false. This will retain local orientation and scale rather than world orientation and scale, which can prevent common UI scaling issues.
UnityEngine.Transform:set_parent(Transform)
HutongGames.PlayMaker.Actions.SetParent:OnEnter() (at Assets/PlayMaker/Actions/GameObject/SetParent.cs:38)
HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:205)
HutongGames.PlayMaker.FsmState:OnEnter() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:175)
HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2767)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2714)
HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2642)
HutongGames.PlayMaker.Fsm:Start() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1925)
PlayMakerFSM:Start() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:548)

Though I have no idea what I am doing, I somehow created an action using the suggested SetParent method which works and doesn't throw errors. I named it SetParent3 (there is already a second one in Ecosystem).

This action will do the (basic) trick, however, it currently has no other parameters (I have no clue how/what). If a regular wants to complete it, and upload it to ecosystem, you're super welcome. It would be best, I guess, when the default "Set Parent" works universally.

Cheers.