playMaker

Author Topic: World to Screen error "No MainCamera defined" so how do you define MainCamera ?  (Read 2937 times)

t4d

  • Junior Playmaker
  • **
  • Posts: 70
Hi Getting the below error trying to use in a scene where I switch cameras alot

how do I define to the World to Screen action, what the current main camera is ?

do I rename the main camera to "Main Camera"  or am I missing something ???

basicly what i want if the Focus object text string to follow the focus 3D object.

thinking world to screen action create GUI Position variable then Set position using the GUI Position

but not getting any value currently using World to Screen ??

---------------------------------------------------------------------------------------
Active_Text : FSM GUI Convertor : State 2 : WorldToScreenPoint : No MainCamera defined!
UnityEngine.Debug:LogError(Object)
HutongGames.PlayMaker.FsmLog:AddEntry(FsmLogEntry, Boolean) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmLog.cs:174)
HutongGames.PlayMaker.FsmLog:LogAction(FsmLogType, String, Boolean) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmLog.cs:393)
HutongGames.PlayMaker.FsmStateAction:LogError(String) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmStateAction.cs:203)
HutongGames.PlayMaker.Actions.WorldToScreenPoint:DoWorldToScreenPoint() (at Assets/PlayMaker/Actions/WorldToScreenPoint.cs:66)
HutongGames.PlayMaker.Actions.WorldToScreenPoint:OnEnter() (at Assets/PlayMaker/Actions/WorldToScreenPoint.cs:49)
HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:201)
HutongGames.PlayMaker.FsmState:OnEnter() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:169)
HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2488)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2446)
HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2374)
HutongGames.PlayMaker.Fsm:Start() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1689)
PlayMakerFSM:Start() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:455)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Hi,
maybe the action Set Main Camera can help you out, so when you switch to a different camera, store it in to a variable and use that to set the main camera

t4d

  • Junior Playmaker
  • **
  • Posts: 70
no does not work

I have around 15 cameras in the scene My camera manager  switches cameras by turning on the next camera, sets it to Main Camera and turn off the previous Camera. I have the "CurrentCamera" and "Old Camera" in a variable (having more then one Camera active blows out FPS)

I tried doubling up the add Set MainCamera request  by adding another to the World to Screen FSM and using CurrentCamera variable as the driver but didn't work.

I also tried adding the MainCamera Tag to the CurrentCamera (& untagged the old Camera) also didn't work ?

this is Not working with World to Screen no values appear in the Screen Coordinates. 
What other workaround are there ?
is there a way to set Current camera in the World to Screen Action ? 


below is currently what i have as you see no values in Screen space and still getting No Main Camera definded! error
« Last Edit: June 20, 2016, 03:04:31 AM by t4d »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Hi,
as i understand only one camara will be active right?

I can't test now myself but maybe you can try setting
the tags of all cameras to MainCamera, then disable only the camera components

Then 1st disable the current camera that is on and then enable the new one (in the same frame)

if that does not work maybe you can change the position of you main camera instead of using 15 cameras?

If it is on a moving object you can put children objects (empty)
on your moving object so you can use
"set parent" and "set transform" Space = Self (i believe) to place your camera

t4d

  • Junior Playmaker
  • **
  • Posts: 70

I can't test now myself but maybe you can try setting
the tags of all cameras to MainCamera,

that did it Thanks  ;D

 tagging all the camera as Main Camera worked

tho would be nice to be able to set it as a variable I've run into another issue.. back to post once I've done some testing...